Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1705
When I right click on a grid, it doesn't activate that row
posted

How can I make right clicking activate a row?

Parents
  • 990
    posted

    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) Then

    Dim 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 If

    End Sub

Reply Children