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
Loading
Dipankar BiswasPosted Jul 31, 2014, 12:54 PM
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