|
Question : How to Call MDI Child Events from MDI Parent...not all MDI Children are the same form
|
|
I have an MDI form that opens several different MDI children. I also have a toolbar button that Exports the MDI Child data to Excel. When this Excel button is clicked, I need to fire an event of the active MDI child that responds to this Excel button in the MDI Parent.
Maybe I should use a form that all MDI children inherit from? But..I need massive control over the UI. And..I'm not really sure how to set that up.
I'm hoping I can just get the type of the active MDI Child and then Cast and execute the related event. Possible?
|
|
Answer : How to Call MDI Child Events from MDI Parent...not all MDI Children are the same form
|
|
You can use late bound, declare the variable as object
Dim tempChile As Object = Me.ActiveMdiChild
'If an error occur will be handled by the try
try TempChild.FunctionOrSub( ParametersIfAny) catch ex as exception end try
The other solution is create class that inherits from the form and then your form should inherit from the new class.
In tha case you would cast.
|
|
|