-
March 12th, 2012, 08:02 PM
#1
[RESOLVED] Windowsforms MDI query
OK, here's a couple of really dumb questions!
I have an MDI window with multiple child forms. The user can hide or display child windows by checking/unchecking in a View menu on the main form, calling on either the Show or Hide methods for that form. Each time I call the show method do I also have to specify myForm.MdiParent = Me, or do I only have to specify that once, ie does vb remember that the form will always be a child? Is there way of specifying this at design time?... it doesnt appear to be a form property any more (from vb6).
Second question relates to forms themselves. If I have created a form at design time, is it more efficient to create an instance of that form using New, or simply show the form as it is by just loading it. What are the pros or cons, memory and speed wise? In my case I will never need more than one copy of that form to appear, I'm using VB2005.
Thanks...
-
March 17th, 2012, 02:46 AM
#2
Re: Windowsforms MDI query
Originally Posted by alynx
OK, here's a couple of really dumb questions!
There is no such thing as a dumb question. In the words of Albert Einstein: It's not answers that change the world, it is questions.
Now I sound clever....
Originally Posted by alynx
I have an MDI window with multiple child forms. The user can hide or display child windows by checking/unchecking in a View menu on the main form, calling on either the Show or Hide methods for that form. Each time I call the show method do I also have to specify myForm.MdiParent = Me, or do I only have to specify that once, ie does vb remember that the form will always be a child? Is there way of specifying this at design time?... it doesnt appear to be a form property any more (from vb6).
You usually set the form's parent upon the forms creation. Ie. in the Load event of your MDI form, you should set all the forms' parent to the MDI.
Originally Posted by alynx
Second question relates to forms themselves. If I have created a form at design time, is it more efficient to create an instance of that form using New, or simply show the form as it is by just loading it. What are the pros or cons, memory and speed wise? In my case I will never need more than one copy of that form to appear, I'm using VB2005.
Thanks...
Well, it is better to use New, as Forms are in fact, classes. If you just Show a Form, it does the initialization in any case, so in fact, it does call the New constructor before showing the form.
-
March 19th, 2012, 07:08 PM
#3
Re: Windowsforms MDI query
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|