DataGridView is dynamically generated, bind ContextMenuStrip to implement right-click menu, want to achieve the function of copying data on DataGridView. There is more than one DataGridView on the
interface. I want to use a menu handler to implement the function. The question is, how can I let ContextMenuStrip know which DataGridView pop-up menu I right-clicked?
the function of right-click menu is as follows:
private void ToolStripMenuItem1_Click(object sender, EventArgs e)
{
DataGridView dgv = ;
if (dgv.SelectedCells.Count > 0)
{
Clipboard.SetDataObject(dgv.GetClipboardContent()); //
}
else
{
MessageBox.Show("");
}
}