MDI Parent's & context menus

GWILSON1981

New member
Joined
Oct 26, 2006
Messages
3
Programming Experience
Beginner
Hello

I am very new to Visual Studio 2005 so please excuse my lack of knowledge! I've searched all over the place but can't find anything that exactly answers my question (or doesn't use the 'me' keyword!).

Essentially I want to know two things:

1. How can you specify what a form's MDI parent is? E.g. Frm1 is the parent. Frm2 opens within the parent with no problems, however, how do you specify the parent form in frm3 (which is opened from frm2 so using the 'me' keyword is no use).

I guess i'm looking for somethingl like frm2.parent = "frm1" but it doesn't seem to exist!

2. Another easy one I'm sure - how do you specify the context menu to be used by a form. I have several context menus and I want to be able to change which one is used by a form programatically.
 
1. When you create a new mdi child you set its MdiParent property. From that child you can also access this property - then it is a property of itself so you can do Me.MdiParent for the child to know what its mdi parent is.

2. The control has got a ContextMenu property for this.
 
Hi

Thanks for this, I kinda knew this already but couldn't figure out the syntax. It's working now :)

The only other thing that's annoying is this: On the Parent I have a treeview docked to the left and a listview filling out the rest of the form. The treeview acts like a navigator and selecting a node causes a form to open or the listview to be populated.

The forms do open (and now within the parent) BUT, you can't see them because they appear behind the listview. BringToFront doesn't work.

Any ideas?
 
You answered yourself, when clicking treeview you either populate listview or hide listview and show form. Also I would have used a Splitcontainer and added the form to left panel only, saves you the mess about form behind treeview too.
 
Back
Top