Event Handling between forms :oS
Posted on 2006-07-18
Not quite sure of the best way to explain this and whether it is possible.
I have a bar of buttons on a MDI form and a panel (panel1). As i load up forms into the panel1 I want this bar of buttons to be used against subs in the currently loaded form.
i.e. if form1 is loaded in panel1 and user clicks the "print" button, this calls form1.print (all forms will have subs for all the buttons in the toolbar)
How do I get from the on_click event for the button (I am creating the buttons on the fly) on the MDI form to calling the event in the form that is currently loaded?
Private Sub Toolbarbutton_Clicked(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim f As Form
For Each f In Panel1.Controls
If TypeOf f Is Form Then 'Only one form is ever loaded into panel1
'This gives me a handle on the form - but i can't do say, f.print. And as I don't know the "type" of form i can't do CType either can I?