O
ommail
I have two RichTextBox controls on a form, and single
ContextMenuStrip
control which serves for both textboxes.
I need to determine which RichTextBox control invokes an event handler
in
ContextMenuStrip.
So I use that code:
private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
((RichTextBox)contextMenuStrip.SourceControl).Paste();
}
It works good if I press right mouse button and select paste item,
but if I try Ctrl+V instead of use mouse I get NullReferenceException.
What to do, to make this thing work both for using mouse and keyboard
shortcut?
Regards
ContextMenuStrip
control which serves for both textboxes.
I need to determine which RichTextBox control invokes an event handler
in
ContextMenuStrip.
So I use that code:
private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
((RichTextBox)contextMenuStrip.SourceControl).Paste();
}
It works good if I press right mouse button and select paste item,
but if I try Ctrl+V instead of use mouse I get NullReferenceException.
What to do, to make this thing work both for using mouse and keyboard
shortcut?
Regards