SheldonC
asked on
How do I change focus of the row a datagridview control to the row that is right-clicked before a contextmenustrip option is selected or shown?
I have a context menu strip attached to a datagridview control. My context menu strip has two options, add a row or remove a row. I am able to do both successfully but I am having a problem remove the correct row when I right click on the row in question. It would only remove the row that was last selected or in other words, that I last left clicked on.
I attempted to use the mouse_click event of the datagridview control but it is executed after the menu strip options have been displayed and selected.
I attempted to use the mouse_click event of the datagridview control but it is executed after the menu strip options have been displayed and selected.
jQuery can help you in this scenario.
check this out:
http://stackoverflow.com/questions/1206203/how-to-distinguish-between-left-and-right-mouse-click-with-jquery
Other mouse events:
http://api.jquery.com/category/events/mouse-events/
you can also prevent contextmenu poping up.
check this out:
http://stackoverflow.com/questions/1206203/how-to-distinguish-between-left-and-right-mouse-click-with-jquery
Other mouse events:
http://api.jquery.com/category/events/mouse-events/
you can also prevent contextmenu poping up.
ASKER
Isn't jquery a javascript command? I am using VB .Net
@mroonal
Little tip: datagridview is winforms. Gridview is webforms :-)
Either handle the CellClick event of the grid and set the currentcell or handle the Click event, supply the x,y to HitTest method to find the cell under click and set the currentcell.
Little tip: datagridview is winforms. Gridview is webforms :-)
Either handle the CellClick event of the grid and set the currentcell or handle the Click event, supply the x,y to HitTest method to find the cell under click and set the currentcell.
ASKER
can I get a code sample?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER