Results 1 to 2 of 2

Thread: can i "release" all variables in a form when I unload it?

  1. #1

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Hi. when I unload a form and go to another like so:

    Load frmB
    frmB.Show
    Unload frmA

    I want to be able to nullify all values for any variables that I added to the form. In one app., I found that going back to that page after unloading it and then clicking back in to it (at runtime), it is still holding values assigned from the previous instance.

    Ideas?

    Thanks


    Wengang
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Location
    Australia
    Posts
    82
    Yes you are right, any variables declared at form level will not be destroyed when the form is unloaded. To destroy all form variables when the form is unloaded, make sure that the last statement in your Form_Unload routine sets the form to Nothing.

    Code:
    Private Sub Form_Unload(Cancel As Integer)
       'Your Form Unload code in here (if any)
       .
       . 
       Set frmA = Nothing
    end sub
    Cheers
    Adrian

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