I want to ask how to pass a specific cell value from a DataGridView to a Label or TextBox when I right-click on a Cell.
There is no problem with a left-click.
My code:
Private Sub DataGridView1_CellClick (ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
Dim i As Integer
With DataGridView1
if e.RowIndex >= 0 Then
i = .CurrentRow.Index
tbID.text = .Rows(i).Cells("id").Value.ToString
tbFirstName.Text = .Rows(i).Cells("firstname").Value.ToString
tbLastName.Text = .Rows(i).Cells("lastname").Value.ToString
tbAddress.Text = .Rows(i).Cells("address").Value.ToString
End If
End With
End Sub