Place the following code into the CellContentClicked event of the datagridview
Dim n_current_row As Integer
Dim n_current_column As Integer
Dim n_clicked_id As Integer
Dim d_row As DataGridViewRow
n_current_row = e.RowIndex
n_current_column = e.ColumnIndex
If n_current_row < 0 Then Exit Sub ' no data
d_row = DataGridView1.Rows(n_current_row) ' d_row is now a row object with all fields
n_clicked_id = d_row.Cells(0).Value ' asuming field(0) contains the id