how to select the newly added row in datagridview

  • Thread starter Thread starter mike
  • Start date Start date
M

mike

I have a datagridview control and a button on the windows form. I am
adding a new row in button click event. When the number of rows grow,
the newly added row will not be
visible but a scroll bar will be shown.

I want the program to highlight the newly added row and make it visible

in the datagridview by scrolling to that position when a new row was
added by button click event. How can you do that? Thanks in advance.
 
Me.DataGridView1.DataSource = dt
Me.DataGridView1.MultiSelect = False
Me.DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
Me.DataGridView1.CurrentCell = Me.DataGridView1.Item(0, 2)
(obviosuly find the cell of the newly added row by checking the row count
of your dataset or collection that is bound)
 
Back
Top