Datagridview select row and column
Hi,I has a problem here...
I has a datagridview and now I would like to determine that whether column1 in row 1 is selected by the user.What should I write to do so?
Code:
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
If (DataGridView1.Rows(1).Cells(1).Selected) Then
MessageBox.Show("")
End If
End Sub
Re: Datagridview select row and column
Welcome to the forums :wave:
I think your problem lies in the fact that the first row is row 0, and the first column is column 0.
Also note that you can determine the cell by looking at e.columnIndex and e.rowIndex.
Re: Datagridview select row and column
You can look at this post and this post on the same thread .. its a little more advanced than what you looking to do, but will help you ...
Gremmy..