views:

14

answers:

0

I have a DataGridView with a DataTable set to its DataSource. The DataTable has two columns. The user has a TextBox which dynamically (after each keypress) searches for a match in the first column. I want to jump to the matching record (if any) after each key entry, so it needs to be fast. I use the Find() method on the DefaultView of the DataTable. I then position the Currency Manager, which causes the DataGridView to jump to the correct record.

However, this all breaks when the user elects to sort by the second column. That changes the sort in the DefaultView, and Find() can no longer search on the first column.

If I create a second DataView which is always sorted by the first column, the I can always perform Find(), but then I do not know how to identify the corresponding record in the DataGridView.

Is there a way to use Find() on a column in the DataTable despite the bound DataView being sorted by a different column, and still jump to the found row in the DataGridView?