CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006
    Posts
    17

    [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...

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Windowsforms MDI query

    Quote Originally Posted by alynx View Post
    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....

    Quote Originally Posted by alynx View Post
    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.


    Quote Originally Posted by alynx View Post
    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.

  3. #3
    Join Date
    Jun 2006
    Posts
    17

    Thumbs up Re: Windowsforms MDI query

    thanks for that!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured