Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have a datagridview named dgv1, and it's datasource is a datatable named dt1. For the same data row, the row index in dt1 may be different from the row index in dgv1 after some operation on dgv1, for example sorting. Now, I have one row's index in dt1, and I want to find it's corresponding row in dgv1. Is there any method other than searching data row's value in dgv1?
Posted

1 solution

The simpe thing to do is to directcast the items as your class item. That way you shouldnt need to worry about the index placing.... You can however use the IndexOf in the enummarable collection to get the index of your casted item.
 
Share this answer
 
v2
Comments
daiwuju 6-Aug-12 21:03pm    
Could you give me some sample code in C# ?

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