Determine what control the ContextMenuStrip was used on
问题 I have a ContextMenuStrip that is assigned to several different listboxes. I am trying to figure out when the ContextMenuStrip is clicked what ListBox it was used on. I tried the code below as a start but it is not working. The sender has the correct value, but when I try to assign it to the menuSubmitted it is null. private void MenuViewDetails_Click(object sender, EventArgs e) { ContextMenu menuSubmitted = sender as ContextMenu; if (menuSubmitted != null) { Control sourceControl =