How can I make right clicking activate a row?
This code is lifted directly out of one of our projects so some parts will not be relevant but it should point you in the right direction.
' When the right mouse button has been clicked, select the row if it is not already selected
If (e.Button = System.Windows.Forms.MouseButtons.Right) Then
If (cell IsNot Nothing AndAlso cell.IsDataCell AndAlso Not cell.Row.Selected) Then
listGrid.Selected.Rows.Clear()
cell.Row.Activate()
cell.Row.Selected = True
End If
End Sub
Andy Jones said: This code is lifted directly out of one of our projects so some parts will not be relevant but it should point you in the right direction.Private Sub listGrid_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles listGrid.MouseDown ' When the right mouse button has been clicked, select the row if it is not already selected If (e.Button = System.Windows.Forms.MouseButtons.Right) ThenDim cell As UltraGridCell = GetCellAtPoint(New Point(e.X, e.Y)) If (cell IsNot Nothing AndAlso cell.IsDataCell AndAlso Not cell.Row.Selected) Then listGrid.Selected.Rows.Clear() cell.Row.Activate() cell.Row.Selected = True End If End IfEnd Sub
cell.Row.Selected =
This looks like it might work, but where is the GetCellAtPoint() method? What object does that belong to?