Mdi question: How to access controls from mdi child form?

Mdi question: How to access controls from mdi child form?

Post by anV2a » Fri, 18 Nov 2005 23:02:08


Hi,

I am new to the mdi developement with vb.net. I have a mdi parent form
called frmMain and a child form called form1.

form1 contains treeview1 --> how can I expand the nodes from the parent form?

I tried it like this:

form1.treeview1.expandall()

thank you for your help....juvi
 
 
 

Mdi question: How to access controls from mdi child form?

Post by Robbe Morr » Tue, 22 Nov 2005 10:08:11

I think most people would make a class level variable
for use with your child form. You'd need to
adjust your tree in the child form to be
public.

private Form MyForm = null;

private void SomeMethodToLaunchTheForm()
{
MyForm = new MyForm();
MyForm.MDIParent = this;
MyForm.Show();
}

private void SomeMethodToMessWithTheTree()
{
MyForm.TreeViewDefinedAsPublic.Nodes.Add(blah,blah,blah);
}
--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.yqcomputer.com/