Hi Lennart,
I'm not exactly sure what you are asking, but here is some code that will
select the row of the DataGridView that is bound to a DataRow with a
specific primary key value:
int primaryKey = 5;
// assuming dataGridView1 is bound to dataTable
int rowIndex = dataTable.Rows.IndexOf(dataTable.Rows.Find(primary Key));
dataGridView1.Rows[rowIndex].Selected = true;
You can replace "dataTable.Rows" with "dataView" in the above code if
dataView is a DataView to which the DataGridView is bound instead of
dataTable.
- Dave Sexton
"Lennart" <le**@comhem.sewrote in message
news:uK**************@TK2MSFTNGP02.phx.gbl...
Hi
I have a DataGridView on a Form filled with data from a DataTable. When I
Load this form I want to select a row in the DataGridView depending on a
selected Primary Key index;
How do I do this?
/Lennart