Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting a row in a datagridview

Status
Not open for further replies.

gharabed

Programmer
Sep 7, 2001
251
US
I have a datagridview bound to a dataTable so that the data is displayed in the dataGridView. The datatable contains a <key> (say unique integer) and some other values. I have a specific <key> value whose associated row I want to select in the dataGridView. How would I go about determining the rowIndex in the dataGridView for the correct row to select? Would I have to iterate through the dataTable or the dataGridView and check the <key> value for each row until I find it or is there some "search" or "find" method I can call in the dataTable that will allow me to get the rowIndex?


 
Use BindingSource.find() to get the row index and BindingSource.Position to move to the index
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top