Hi lenusia,
You can retrieve the source by retrieving the ContextMenuStri p from the
ToolStripItem. You can retrieve the source control (the treeview you are
looking for) from the ContextMenuStri p.SourceControl . Like:
ToolStripMenuIt em tsItem = (ToolStripMenuI tem)sender;
ContextMenuStri p cMenuStrip = (ContextMenuStr ip)tsItem.Owner ;
Control theSourceContro l = cMenuStrip.Sour ceControl;
TreeView myTreeView = (TreeView)theSo urceControl;
MessageBox.Show (myTreeView.Nam e);
Note: you realy should check your objects before making explicit casts,
unless you are 100% shure nothing else could have raised the event.
Regards,
Nico
"Lenusia" wrote:
In my program I dynamically create treeViews and dynamically add nodes to them.
To each node I attach ContextMenuStri p which suppose allow delete selected
node
e.t.c.
How from inside click event handling function to find which node was selected?
sender is set to ToolStripItem clicked.