You must make that sub friend or public (can't be private), and you must
pass a reference of the main form to the child form. The child form can
retain this reference (as a class field), and then use it to call the sub.
So, for example, if you create a myMainForm property on the child form, then
you can code:
mainform.myPanel.Controls.Add(childform)
childform.myMainForm = mainform
then, from inside childform you can do the following:
myMainForm.subName([paramater list goes here])
-Rob Teixeira [MVP]
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:OT**************@TK2MSFTNGP11.phx.gbl...
Hi
I have a main form which has a panel which contains a child form using the
code;
mainform.myPanel.Controls.Add(childform)
So hierarchy is like this; MainForm->Panel->ChildForm. My question is how
can I access a sub in the main form, from the child form?
Thanks
Regards