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

G

Guest

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
 
R

Robbe Morris [C# MVP]

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);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top