Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

UserControl on Form, How To Know Which Form It Is Embedded On

$
0
0
I have a usercontrol with a single combobox. I would like to use this same usercontrol on
two different forms. On each form, I seem to add the usercontrol properly, as it is visible on those forms:
myusercontrol control = new myusercontrol();
control.show();
myform1.Controls.Add(control);



On the usercontrol, I will get the index in the combobox through the SelectedIndexChanged() event.
Then, based on which of the two forms I am on, I would call the appropriate method. How, from the usercontrol,
can I tell which of the two forms that I am on, so that I know whether to call myform1.thefunction() or myform2.thefunction()?

Thanks in advance.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>