T
Tyson Marchuk
New to C# and databases...
I've been searching newsgroups and websites for a while and can't find an
answer so I figured I'd ask...
What I want to do is determine the row number in a DataGrid that coresponds
to a DataRow in the associated DataTable. (I also know the row number of
this DataRow in the DataTable if that helps.)
I want to do this because I'm programatically adding/updating items to this
DataTable when the user does various other things in the application and I
want to select/highlight the row that was changed/added and make it the
currently selected row. I can't use the row number in the DataTable because
if the user sorts the DataGrid these numbers no longer match.
Note: I'm not looking to find the DataRow for the currently selected row.
There's lots of code showing how to do this using BindingManagerBase... I'm
trying to set the current row based on a DataRow that I've modified.
Of course there's the brute-force approach of going though all rows in the
DataGrid looking for my Primary Key value but surely there's a more
efficient way of doing this?
Thanks for any help you can provide,
-Tyson Marchuk
I've been searching newsgroups and websites for a while and can't find an
answer so I figured I'd ask...

What I want to do is determine the row number in a DataGrid that coresponds
to a DataRow in the associated DataTable. (I also know the row number of
this DataRow in the DataTable if that helps.)
I want to do this because I'm programatically adding/updating items to this
DataTable when the user does various other things in the application and I
want to select/highlight the row that was changed/added and make it the
currently selected row. I can't use the row number in the DataTable because
if the user sorts the DataGrid these numbers no longer match.
Note: I'm not looking to find the DataRow for the currently selected row.
There's lots of code showing how to do this using BindingManagerBase... I'm
trying to set the current row based on a DataRow that I've modified.
Of course there's the brute-force approach of going though all rows in the
DataGrid looking for my Primary Key value but surely there's a more
efficient way of doing this?
Thanks for any help you can provide,
-Tyson Marchuk