- You are here
- Microsoft Newsgroups Archived.At
- microsoft.public.vsnet.general
- 2008 December
- Which DataGridViewRow?

Subject: | Which DataGridViewRow? |

Posted by: | Ed White (ewhite@newsgroups.nospam) |

Date: | Wed, 17 Dec 2008 |

I have a DataGridView ("DGV") bound to a DataSet, and the columns in the DGV

can be sorted. When a column in the DGV is sorted, the row numbers in the

DGV no longer match the row numbers in the DataSet. After the DGV has been

sorted, how can I find the corresponding row number in the DataSet for a

given row number in the DGV, and vice-versa?

For example, before sorting, both the DGV and the DataSet contain "ABC" in

row 0. Suppose after sorting the DGV, "ABC" is now in DGV row 8 (it will

still be in row 0 of the DataSet). Now what I want is to ask, for row 0 of

the DataSet (which contains "ABC"), which is the corresponding row in the DGV

that contains "ABC" (the answer provided should be 8), or conversely, for row

8 of the DGV which I can see contains "ABC", what is the corresponding row in

the DataSet (answer should be 0). How can I get the corresponding row

numbers?

--

Ed

- RE: Which DataGridViewRow? posted by v-zh…@online.microsoft.com on Thu, 18 Dec 2008