Home > VB.NET > Move to Next DataGridView Row via Code

Move to Next DataGridView Row via Code


Dim _rowIndex = grdDataLines.SelectedRows(0).Index + 1
If _rowIndex <= grdDataLines.Rows.Count - 1 Then

Dim nextRow As DataGridViewRow = grdDataLines.Rows(_rowIndex)

' Move the Glyph arrow to the next row
grdDataLines.CurrentCell = nextRow.Cells(0)
grdDataLines.Rows(_rowIndex).Selected = True

End If

Advertisements
Categories: VB.NET Tags:
  1. tiny
    March 8, 2013 at 5:32 am

    Really a big help thanks!!!

  2. ahmadKhalifa
    December 8, 2013 at 6:52 am

    grdDataLines.Rows.Add()
    grdDataLines.Rows(grdDataLines.CurrentRow.Index).Selected = True
    ‘—————————————————————
    add the above lines before that code

  3. January 5, 2014 at 1:40 am

    thanks
    sir 🙂

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: