run a sub on one child form when an event occurs on another
-
Ok, this one is driving me nuts, can someone tell me what I am doing wrong? I have a few MDI child forms open within a parent. I need to run a sub on one of the child forms when an event occurs on another. For example one of the child forms is created in the Load event of the MDIParent with the following:
Dim ChildForm2 As New GraphFrm ChildForm2.MdiPrent = Me ChildForm2.Show()
The GraphFrm contains aSub UpdageGraphs()
but when I attempt to callChildForm2.UpdateGraphs()
from the parent or any of the other MDI child forms I get an error that ChildForm2 is not declaired. How do I make this instance of the child form accessible to the Parent and other child forms?David Wilkes
-
Ok, this one is driving me nuts, can someone tell me what I am doing wrong? I have a few MDI child forms open within a parent. I need to run a sub on one of the child forms when an event occurs on another. For example one of the child forms is created in the Load event of the MDIParent with the following:
Dim ChildForm2 As New GraphFrm ChildForm2.MdiPrent = Me ChildForm2.Show()
The GraphFrm contains aSub UpdageGraphs()
but when I attempt to callChildForm2.UpdateGraphs()
from the parent or any of the other MDI child forms I get an error that ChildForm2 is not declaired. How do I make this instance of the child form accessible to the Parent and other child forms?David Wilkes
Use delegates to call methods between forms.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Use delegates to call methods between forms.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Thanks for the suggestion. I am still not completely clear on how to accomplish this. I am guessing I would have to define the delegate in the parent but not entirely sure when to assign the address of the function to the delegate.
David Wilkes