ContextMenuStrip with DataGridView problem
Posted on 2008-10-05
I am working in VN2008. I have a DGV in a Windows Form. I have created and bound a ContextMenuStrip object to the DGV, which appears on right-click in the DGV.
My context menu contains only one item ("Flag for action")
I want to call a SQL query and pass a parameter from the selected row in the DGV when the item is selected from the context menu.
I would normally use e.rowindex etc... but this information is not contained in the events for ToolStripMenuItem.Click. How can I identify which row was selected when the context menu was invoked?
I can think of setting a global variable when the right-click is captured and using this but seems very messy. There must be a proper way of doing this.
Many thanks in advance!