CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2001
    Location
    Rhode Island
    Posts
    56

    Unload statement

    I think this is a beginner question:

    I have a child form that triggers another child form to open. The second child form is smaller and loads over the first child. I am disabling the first child form so that the user can see part of it but cannot access it. When the user clicks a 'Close' button on the second child form, it should unload, and enable and return to the first form. In the close routine of Form2, I placed an 'Unload Me', but it unloaded both childs apparently because they were both visible. I tried an 'Unload Form2', but that didn't do a thing. How do I unload just Form2?? Hope this makes sense. Thanks in advance for any help!!


  2. #2
    Join Date
    Apr 2001
    Posts
    4

    Re: Unload statement

    Show that part of code and I can help


  3. #3
    Join Date
    Mar 2001
    Location
    Rhode Island
    Posts
    56

    Re: Unload statement

    There is not much to show, but here it is:



    'IN FORM1:
    private Sub command_Click()
    me.enabled = false
    'Opens Form2 on top of Form1 - Form2 is
    'smaller, so they both can be seen.
    Form2.Show
    End Sub

    'IN FORM2:
    private Sub cmdClose_Click()
    'This Unload me is unloading both forms.
    'I need to only unload Form2.
    Unload me
    Form1.Enabled = true
    End Sub




    Thanks,
    Ron


  4. #4
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Unload statement

    Instead of disabling and enabling forms, you can just use

    Form2.show vbModal

    in Form1 and

    Unload Me

    or

    Me.Hide

    in Form2


  5. #5
    Join Date
    Mar 2001
    Location
    Rhode Island
    Posts
    56

    Re: Unload statement

    Thanks and sorry for the stupid question. That works good. Just a follow-up though. What is standard for Form sizes? The way I am creating the application is mostly an MDIparent with menus and a constant flow of MDIChilds within the parent. I create them all the same size and run it.. one form opening at a time. Is there some sort of standard that is known for how large you should create forms or is it relatively open to the environment and type of application? Just thought I'd ask the gurus while I am here.

    Thanks again!


  6. #6
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Unload statement

    There is no hard and fast rule as I know of, but most MDI applications have the MDI form maximized in the beginning. The child form also opens maximized, and the child form is usually of the sort that it has one control (a picture box or textbox, or richtextbox) that expands to fill most part of the child form. Depends upon your application, however. It is always wise to consider the different resolutions and screen sizes that the user has, and design your form such that it looks consistent over all screen sizes.


  7. #7
    Join Date
    Mar 2001
    Location
    Rhode Island
    Posts
    56

    Re: Unload statement

    Thanks for the tips shree. Have a nice weekend!


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