Results 1 to 8 of 8

Thread: Closing A UnKnown Form

  1. #1

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408
    I have a MDi form and when you click new on the menu it makes a new form1. When I click close I want it to close only the form1 that has focus. Is this even possible because I have tried many different ways of declaring variables and nothing is working. Thanks!!
    Sincerely,
    Chris


    Email: [email protected]
    AIM: KnightsOfTheMoon
    WebPage: http://kom.wicre.com
    ----------------
    VB6 Professional
    Abit ST6-RAID
    1000 MHZ
    512 MB PC133 Ram
    Nvidia GeForce 2 Ultra 64 MB
    Maxtor 81.9 Gig
    Win 98 SE

  2. #2
    Guest
    This will close the ActiveForm.
    Code:
    Private Sub Command1_Click
        Unload MDIForm1.ActiveForm
    End Sub

  3. #3
    Guest
    Don't try that in VB6!

    I did that before and I got 3 errors!

    Here's a great way:

    Code:
    Set MDIForm.Activeform = Nothing

  4. #4
    Guest
    That doesn't unload a Form. The method I provided does.

  5. #5

    Thread Starter
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Talking

    hey thanks the Unload me.activeform works thanks a lot!!!
    Sincerely,
    Chris


    Email: [email protected]
    AIM: KnightsOfTheMoon
    WebPage: http://kom.wicre.com
    ----------------
    VB6 Professional
    Abit ST6-RAID
    1000 MHZ
    512 MB PC133 Ram
    Nvidia GeForce 2 Ultra 64 MB
    Maxtor 81.9 Gig
    Win 98 SE

  6. #6
    Guest
    Well, Megatron, I don't know. My VB must be in a buggy mode. I've got SP4 now and I'll try that...or I'll use C++.

  7. #7
    Guest
    Escaflowne, in order to unload a form, you must use Unload MDIForm1.ActiveForm. But Set MDIForm.Activeform = Nothing can be used as well to clear up any resources that were being used, but not just by itself.

    Code:
    Private Sub Command1_Click()
    
        Unload MDIForm1.ActiveForm
        Set MDIForm.Activeform = Nothing
    
    End Sub

  8. #8
    Guest
    Originally posted by Escaflowne
    Well, Megatron, I don't know. My VB must be in a buggy mode. I've got SP4 now and I'll try that...or I'll use C++.
    What error message do you get?

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