Datagrid: Row Highlight

ayozzhero

Well-known member
Joined
Apr 6, 2005
Messages
186
Location
Malaysia
Programming Experience
1-3
[Resolved] Datagrid: Row Highlight

I am setting the datagrid RowHeadersVisible to False, and ReadOnly to True

Whenever user clicks any cell in the datagrid, how do I highlight the whole row, or change the background colour of the whole row?

Thank you.
 
Last edited:
[Resolved] Datagrid: Row Highlight

No problemo... just found the way. I write it here for future reference.

I am using the MouseUp event.

Private Sub dg_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dg.MouseUp
Dim pt = New Point(e.X, e.Y)
Dim hit As DataGrid.HitTestInfo = dg.HitTest(pt)
If hit.Type = Windows.Forms.DataGrid.HitTestType.Cell Then
dg.CurrentCell = New DataGridCell(hit.Row, hit.Column)
dg.Select(hit.Row)
End If
End Sub
 
Back
Top