Common Context menu for two controls

B

bob

Hi,
I have a context menu that copies the selected items in a listbox to
the clipboard.
I want to use it on two listboxes and can't see how to detect the
parent control in the event handler.
i.e.
Something along the lines of:
IEnumerator en = ((ListBox)sender).SelectedItems.GetEnumerator();
(except that sender is a toostripmenuitem)
thanks
Bob
 
B

bob

Hi,
In case anybody else strikes something similar.
Workaround was to declare a class level Listbox.
Use the selectedindex changed events of the form listboxes to point
it at the 'current' list box.
Refer to the declared variable in the context menu event handler.
Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top