Results 1 to 7 of 7

Thread: Close a form in code

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Posts
    124
    How to close a form totally in codes ? I was using "form.hide" all the time which I don't think it is appropriate.

  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Whether you have 1 or form or 40 forms this is the best way to make there they all are unloaded.

    Code:
    Public Sub EndProg() 
     dim f as Form
    
        For Each f in Forms
    
           f.Hide
           Unload f
    
        Next f
    
    End Sub
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  3. #3
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Unhappy

    I did this before, but the memory still not really release after the "For Each f in Forms" routine. Even I add the Set f = Nothing also not mush help in the memory release issue that I encounter. (I monitor the memory usage through the Task Manager.)

    How does we recover all the used memory when a form is unload.

  4. #4
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Code:
    Public Sub EndProg() 
     dim f as Form
    
        For Each f in Forms
    
           f.Hide
           Unload f
    
        Next f
    
        End ' Try Adding This also
    
    End Sub
    I've heard from a few places that VB has some memory management issues so I'm not sure if that is a possibility.
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  5. #5
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Unhappy

    Hi! YoungBuck, noop... What I mean is I have a MDI Form, when I unload a child form (Main program still running) it did not really release the memory.

  6. #6
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    Chris,

    The MDI Child form is associated in memory with the parent form and will leave a footprint. This memory is not released until the parent form is closed.

    The way MDI is handled in VB really sucks.

    Cheers,

    P.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  7. #7
    Member
    Join Date
    Oct 2000
    Location
    Netherlands
    Posts
    54

    Talking Job

    I also want a job at the Fortis Bank and become a hyperactive member using the companies Internet connection

    Waar zit die bank?
    A mind is like a parachute, it has to open to let it work
    www.2beesoft.com for Icon Manager with over 20.000 free icons
    VB6 Ent. SP4, ASP, W2000/W98

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