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

Hybrid View

  1. #1
    Join Date
    Apr 2003

    Unload Form does not always terminate program execution

    I've seen several cases where all of the forms in my app are closed, yet dialog boxes still pop up, indicating a problem.

    This makes the users feel uneasy :-)

    What is the proper way to COMPLETELY terminate execution in a VB app, after all the forms have been unloaded ?

  2. #2
    Join Date
    Jan 2003
    7,107 Islands
    Just make sure that after you have unloaded the form there shoud be no code in the program that makes use of the form.

  3. #3
    Join Date
    Jun 2004
    I agree with Thread1. If there is a need for a form to call an object in another form, programmer must explicitly define a way so that the calling form first check if the owner of the object to be called is loaded or not.
    I am inviting you to join GreenZap. It is just like PAYPAL but it is more rewarding! You get $25 when you join (FREE to sign up) AND you get rewarded also when someone opened an account using your GreenZap promo code! GreenZap is launching June 1st.

    Click here and PREREGISTER

    Have a break. Visit JonelsPlace

  4. #4
    Join Date
    Dec 2001
    Oddly enough, I've seen cases where a simple single-form program won't completely unload on a system running winME, but on other OS's it's ok. I used End as the last line of code after the form unloads, which seems to have solved the problem.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  5. #5
    Join Date
    May 2000
    KY, USA
    Well...are you sure that all forms are unloaded...? You can check it within the 'Query_Unload' evetn of the main dialog...add the following
    Dim FormX as Form
    For Each FormX in Forms
      if FormX.hWnd<> Me.hWnd then
        Debug.Print "Form is still loaded"
        Unload FormX
      End If

  6. #6
    Join Date
    Jul 2000
    Milano, Italy

    Avoid End command

    Now, read these threads



    and avoid "End" (unless on a very bugged Os...)

    Andreas, nice snippet
    ...at present time, using mainly Net 4.0, Vs 2010

    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.