Results 1 to 2 of 2

Thread: Exit command code

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    4

    Exit command code

    Hi I'm very new to this software (version 6.0) and when constructing small .exe's I find that when I exit the program that the program is still running when I open task manager. I have figured out why- the code I use to switch between forms eg.

    Private Sub cmdnext_Click()
    Form1.Hide
    Form2.Show
    End Sub

    OR

    Private Sub cmdnext_Click()
    Unload Form1
    Load Form2
    End Sub

    The problem is my exit commands only exit the current form so when I exit, the 'hidden' form(s) are still running. Is there anyway of exiting the whole application instead of typing-

    Unload Form1
    Unload Form2
    Unload Form3
    etc....

    -for my exit command code.

    Open to any suggestions thanks.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Exit command code

    Welcome to VBForums

    You can use a fairly simple loop to do it, as shown (along with other things you may not know) in the article How should I close my form/program/class? from our Classic VB FAQs (in the FAQ forum, which is shown near the top of our home page)

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