Gent.mo Oregon,
riporto i codici completi compreso anche la colorazione dei button
per sù:
codice:
Dim msg = "Primo nominativo"
Dim titolo = " Nominativo"
Dim ni As Integer = DataGridView1.CurrentRow.Index
Button2.BackColor = Color.Aquamarine
If ni > 1 Then
DataGridView1.CurrentCell = DataGridView1.Rows(ni - 1).Cells(0)
End If
If ni = 1 Then
DataGridView1.CurrentCell = DataGridView1.Rows(ni - 1).Cells(0)
MsgBox(msg, MsgBoxStyle.Information, (titolo))
Button1.BackColor = Color.Red
End If
per giù:
codice:
Dim msg = "Ultimo nominativo"
Dim titolo = " Nominativo"
Dim ni As Integer = DataGridView1.CurrentRow.Index
Button1.BackColor = Color.Aquamarine
If ni < DataGridView1.Rows.Count - 2 Then
DataGridView1.CurrentCell = DataGridView1.Rows(ni + 1).Cells(0)
End If
If ni = DataGridView1.Rows.Count - 3 Then
DataGridView1.CurrentCell = DataGridView1.Rows(ni + 1).Cells(0)
MsgBox(msg, MsgBoxStyle.Information, (titolo))
Button2.BackColor = Color.Red
End If
Grazie
Domenico