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