i have datagridview contains more than 100 rows: student name, class and code, i want to get on 3 sequences student codes when select any row to show them in 3 textboxes, whatever the position of the row which i selected.
Dim I As Integer = 0
Dim code1 As String = DataGridView1.SelectedRows(I).Cells(1).Value.ToString
TextBox1.Text = code1
Dim code2 As String = DataGridView1.SelectedRows(I + 1).Cells(1).Value.ToString
TextBox2.Text = code2
Dim code3 As String = DataGridView1.SelectedRows(I + 2).Cells(1).Value.ToString
TextBox3.Text = code3
i tried to solve it but it's Error