i am trying to create a nextrow button to work with a bound datagridview
the problems i have:
1. the row moves down, but the first row is the one who has the focus (the little black triangle is staying to it's left.
2. i am trying to set a condition, and that is if the index = the row before last (last row is always empty in a datagridview) then select the row before last.
3. please try and explain what am i doing wrong - i am a newbie
i am getting an index overflow
Private Sub btnNextRow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNextRow.Click Dim iTest As Integer Dim LastRow LastRow = grdAccountTypes.Rows.Count grdAccountTypes.SelectionMode = DataGridViewSelectionMode.FullRowSelect Try If iTest >= LastRow Then iTest = grdAccountTypes(0, 0).Selected = True Else iTest = grdAccountTypes.SelectedRows(0).Index + 1 grdAccountTypes.Rows(iTest).Selected = True End If ' If iTest = LastRow Then ' grdAccountTypes(0, LastRow).Selected = False ' End If Catch ex As Exception MsgBox(ex.Message) End Try End Sub