when I write this code
GridViewPays.CurrentCell = GridViewPays.Rows[1].Cells[0];
it selects the second row
but when I change indexrow to 0
GridViewPays.CurrentCell = GridViewPays.Rows[0].Cells[0];
it doesn't work
what' the problem? I have number sequence column in same datagridview
Select the first row in datagridview
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Dipankar BiswasRank #992 · 2K reputationPosted Jul 31, 2014, 8:54 AM EDT
Dim i As Integer
i = DataGridView1.CurrentRow.Index
'Me.AxAcroPDF1.src = DataGridView1.Item(0, i).Value
If Me.DataGridView1.CurrentCell.ColumnIndex = 1 Then
Me.AxAcroPDF1.src = DataGridView1.Item(1, i).Value
End If
If Me.DataGridView1.CurrentCell.ColumnIndex = 2 Then
Me.AxAcroPDF1.src = DataGridView1.Item(2, i).Value
End If
If Me.DataGridView1.CurrentCell.ColumnIndex = 3 Then
Me.AxAcroPDF1.src = DataGridView1.Item(3, i).Value
End If
If Me.DataGridView1.CurrentCell.ColumnIndex = 4 Then
Me.AxAcroPDF1.src = DataGridView1.Item(4, i).Value
End If
If Me.DataGridView1.CurrentCell.ColumnIndex = 5 Then
Me.AxAcroPDF1.src = DataGridView1.Item(5, i).Value
End If
End Sub
Note: You can use
Me.TextBox.Text = DataGridView1.Item(1, i).Value
Or
Me.Label1.Text = DataGridView1.Item(4, i).Value