
04-07-2006, 11:05 AM
|
 |
Contributor
|
|
Join Date: Oct 2003
Location: Nebraska, USA
Posts: 640
|
|
If im understanding you correctly, you want to select the row (and know which row they click) by clicking on any cell in that row?
If thats the case, this code should do it for you.
Code:
Private Sub DataGrid1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseUp
Dim pt = New Point(e.X, e.Y)
Dim hit As DataGrid.HitTestInfo = DataGrid1.HitTest(pt)
If hit.Type = Windows.Forms.DataGrid.HitTestType.Cell Then
DataGrid1.CurrentCell = New DataGridCell(hit.Row, hit.Column)
DataGrid1.Select(hit.Row)
End If
MsgBox(DataGrid1.CurrentRowIndex)
End Sub
Obviously, change DataGrid1 for the name of your datagrid
Hope that helps
|
|