Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys! I happen to have an employee referee's table where i need to be able to scroll through the rows and display each row value in a control e.g labels. The problem is my solution shows only two referees instead of three yet each employee has three referees. Here is my code.
for(int rowindex=0; rowindex.
Finally how do i tell that am at last row and ask user to go back as in previous row.
Posted
Updated 10-Jun-11 3:50am
v3

1 solution

You should try a foreach loop like this:

C#
DataTable dt = new DataTable();
            foreach (DataRow dr in dt.Rows)
            {
                //Process row
            }


That way you never have to check whether you are on the last row or not, also you have a strongly typed DataRow to work with.

Hope this helps
 
Share this answer
 
Comments
capdevillia 11-Jun-11 1:51am    
Thanks man!
parmar_punit 11-Jun-11 8:23am    
good one, my 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900