I have 3 UserControls (i.e. they inherit System.Windows.Forms.UserControls)
In each of these UserControls, I have a method named "Info()". How can I get this method to be executed without having a direct instantiation of one of the actual controls?
Lets call my 3 controls as
ControlA
ControlB and
ControlC.
They all inherit UserControl (or if need be another class / interface that I have written and which would eventually inherit UserControl).
I am instantiating each Control (A, B and C) and putting it into a structure. This structure consists of two members:
* A Descriptive Name for the Control
* A object of type UserControl (or the other class / interface that is inherited by my 3 controls)
SO when I put the instantiated control into the structure, it gets casted to its parent type.
Ultimately I place this structure into a listbox.
What I want is this:
When the user clicks on any particular item in the listbox, the method "Info()" of the particular control out of the 3 should be executed.
HOw do I do this?
Thanks a lot in advance!! I am quite desperate.
Infimo
In each of these UserControls, I have a method named "Info()". How can I get this method to be executed without having a direct instantiation of one of the actual controls?
Lets call my 3 controls as
ControlA
ControlB and
ControlC.
They all inherit UserControl (or if need be another class / interface that I have written and which would eventually inherit UserControl).
I am instantiating each Control (A, B and C) and putting it into a structure. This structure consists of two members:
* A Descriptive Name for the Control
* A object of type UserControl (or the other class / interface that is inherited by my 3 controls)
SO when I put the instantiated control into the structure, it gets casted to its parent type.
Ultimately I place this structure into a listbox.
What I want is this:
When the user clicks on any particular item in the listbox, the method "Info()" of the particular control out of the 3 should be executed.
HOw do I do this?
Thanks a lot in advance!! I am quite desperate.
Infimo