DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 6 of 6

Thread: Form Unload

  1. #1
    Joe Richardson Guest

    Form Unload


    Hello everyone. I'm having a problem with some variables not being reset
    when a form is unloaded and then re-loaded. I have stepped through the unload
    process, so I know the Form_Unload event fires, but when the form is re-loading
    while the app is still running, several boolean variables keep their values.


    I expected them to be re-set to False. I corrected the problem by setting
    them to False on Load, but wanted to know what the root of the problem was.


    Any help always appreciated.

    L8R

    Joe

  2. #2
    rajesh patel Guest

    Re: Form Unload


    "Joe Richardson" <joe@actman.com> wrote:
    >
    >Hello everyone. I'm having a problem with some variables not being reset
    >when a form is unloaded and then re-loaded. I have stepped through the

    unload
    >process, so I know the Form_Unload event fires, but when the form is re-loading
    >while the app is still running, several boolean variables keep their values.
    >
    >
    >I expected them to be re-set to False. I corrected the problem by setting
    >them to False on Load, but wanted to know what the root of the problem was.
    >
    >
    >Any help always appreciated.
    >
    >L8R
    >
    >Joe


    I think you have declared your variables as 'static' or 'public'. that is
    creating a problem for you.

    if you are not satisfied, give me a mail. we will discuss

    thank you


  3. #3
    Colin McGuigan Guest

    Re: Form Unload

    Joe Richardson wrote in message <38e0ecdc$1@news.devx.com>...
    >
    >Hello everyone. I'm having a problem with some variables not being reset
    >when a form is unloaded and then re-loaded. I have stepped through the

    unload
    >process, so I know the Form_Unload event fires, but when the form is

    re-loading
    >while the app is still running, several boolean variables keep their

    values.
    >
    >
    >I expected them to be re-set to False. I corrected the problem by setting
    >them to False on Load, but wanted to know what the root of the problem was.
    >
    >
    >Any help always appreciated.
    >
    >L8R
    >
    >Joe


    Unloading a form does not 'really' unload it's back-end code from memory.
    Thus, variables will keep their values, etc, unless you re-initialize them
    yourself, as you've noted. It's not really a 'bug', as it were (though I'm
    at a loss as to why you'd want it to operate that way)...just the way things
    are.

    --
    Colin McGuigan




  4. #4
    Joe Richardson Guest

    Re: Form Unload


    Thanks for the help!

    L8R

    Joe

  5. #5
    Alan Gillott Guest

    Re: Form Unload

    After the unload, if you set the form to nothing, the rest of the form
    unloads.
    Joe Richardson <joe@actman.com> wrote in message
    news:38e0fd35$1@news.devx.com...
    >
    > Thanks for the help!
    >
    > L8R
    >
    > Joe




  6. #6
    Jim Pragit Guest

    Re: Form Unload


    Unloading a form only unloads it's "visible" components. Module-level variables
    are unaffected. To get around this, simply Set the form to Nothing when
    you're you're done using it.

    - Jim

    "Joe Richardson" <joe@actman.com> wrote:
    >
    >Hello everyone. I'm having a problem with some variables not being reset
    >when a form is unloaded and then re-loaded. I have stepped through the

    unload
    >process, so I know the Form_Unload event fires, but when the form is re-loading
    >while the app is still running, several boolean variables keep their values.
    >
    >
    >I expected them to be re-set to False. I corrected the problem by setting
    >them to False on Load, but wanted to know what the root of the problem was.
    >
    >
    >Any help always appreciated.
    >
    >L8R
    >
    >Joe



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links