Hello,
I use the mouseup event to select a row in a forms datagrid (using the
hittest info).
I also want to deselect a previously selected row. I thought I use
row.isselected, but thats false!??!?
In other events isselected works fine, but not in the mouseup event?
Strange or is this by design or did I do something wrong?
Below the code.
Thanks
Frank
Private Sub dgClicked(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles dgAlles.MouseUp, dgSel.MouseUp
Dim dg As DataGrid = CType(sender, DataGrid)
Dim pt As System.Drawing.Point = dg.PointToClient(Cursor.Position)
Dim hti As DataGrid.HitTestInfo = dg.HitTest(pt)
If hti.Type = DataGrid.HitTestType.Cell Then
If dg.IsSelected(hti.Row) Then
dg.UnSelect(hti.Row)
Else
dg.CurrentCell = New DataGridCell(hti.Row, hti.Column)
dg.Select(hti.Row)
End If
End If
End Sub