Home Forums WinForms controls Xceed Grid for WinForms How to select cell or row on right click? Reply To: How to select cell or row on right click?

User (Old forums)
Post count: 23064

Okay – finally managed to get this to work and thought I would post the results here, incase anyone else is struggling with this.

I simply used the following code in the mousedown event for the cell (obviously making sure that I added the handler for each cell during grid population):

Private Sub Cell_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
If e.Button = MouseButtons.Right Then
‘Check to see if the cells datarow is already selected or not
Dim oDataRow As DataRow = sender.ParentRow
If Not oDataRow.IsSelected Then
End If
End If
End Sub

This code also checks to see if the row you right clicked on was already selected or not. Obviously, if you are allowing multiple selections within a grid and the row you right clicked on was one of those selected, then you don’t want to clear the other rows that were selected.

Hope someone finds this useful.

Imported from legacy forums. Posted by rjmorton (had 5765 views)