DataGridView control - move to row with desired value in first column

Hi Experts,

I have a DataGridView control with a BindingSource.

When my Form is loaded I want the DataGridView to move to the row given by "RequiredID" which is a unique Index displayed in the first column.

Regards,
Leigh
LVL 1
LeighWardleAsked:
Who is Participating?
 
CodeCruiserConnect With a Mentor Commented:
You will need to loop through the rows and set the selected row

For i as integer = 0 to grid.rows.count - 1
   if grid.item(0, i).value = "myvalue" then
      grid.currentcell = grid.item(0, i)
      exit for
   end if  
Next
0
 
LeighWardleAuthor Commented:
Thanks again CodeCruiser.
0
All Courses

From novice to tech pro — start learning today.