CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Unloading Forms

  1. #1
    Join Date
    Nov 1998
    Posts
    9

    Unloading Forms



    I've noticed with VB that you can unload a form, for example, MyForm.Unload, and the form, MyForm does not really unload from memory. Is there any other way to unload or destroy the Form object in VB.


    Gordito

  2. #2
    Join Date
    Dec 1998
    Posts
    28

    Re: Unloading Forms



    When you unload a form, it removes it from memory, when you hide a form, it is still in memory just not visible.

  3. #3
    Join Date
    Nov 1998
    Posts
    9

    Re: Unloading Forms



    In theory, you are correct Justin, but that was not my question. I know unload is supposed to unload a form from memory ... but from my experience it does not completely take the form out of memory. Has anyone else noticed this behavior?


    Gordito

  4. #4
    Join Date
    Dec 1998
    Posts
    28

    Re: Unloading Forms



    Why do you think that unloading a form does not take it out of memory?

  5. #5
    Join Date
    Nov 1998
    Posts
    10

    Re: Unloading Forms



    I'm sure last time I looked at this, I found that the unload command does not always unload them from memory, or at least the memory is not reclaimed. I had some very large forms, and I examined the memory usuage of the application before, during and after using the form. It did not drop when the form was 'unloaded'. Somebody explained to me, that it's a trick of VB so that it does not have to reload the form if you want to show it again. The system only unloads them proper if it's running low on memory or you explicietly tell it to unload (I forget how)

  6. #6
    Join Date
    Apr 1999
    Location
    Rotterdam, Netherlands
    Posts
    278

    Re: Unloading Forms



    There's an API call something like KillWindow. This will free it definitely (and you can't call it again in your app).

    But, you'll probably not notice it, but lots of programs doesnot free memory when forms are unloaded. Indeed, VB does some memory tricks, but I think not only VB does that... I found out that Borland C++ Builder does the same trick sometimes. And besides that, Windows does not always free the memory directly.

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