How to disable Cell Highlighting in a datagridview, Highlighting should not happen even if I click on the cell.
Any thoughts please
Private Sub DataGridView1_SelectionChanged(sender As Object, e As System.EventArgs) Handles DataGridView1.SelectionChanged
Me.DataGridView1.ClearSelection()
End Sub
That's it. But if you still want to get clicked row/cell index or to access values:
Private Sub DataGridView1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseDown
Dim _ht As DataGridView.HitTestInfo = Me.DataGridView1.HitTest(e.X, e.Y)
If _ht.Type = DataGridViewHitTestType.Cell Then
Me.DataGridView1.Rows(_ht.RowIndex).Cells(_ht.ColumnIndex).Value = _
"RowIndex = " & _ht.RowIndex & ", " & "ColumnIndex = " & _ht.ColumnIndex
End If
End Sub