1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

vb program closing help

Discussion in 'Visual Basic ( VB )' started by kpsg25690, Jun 21, 2011.

  1. kpsg25690

    kpsg25690 New Member

    Joined:
    Aug 28, 2009
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    Hello everyone,i am new to visual basic but have to make an application using it for a project.
    I am familiar with c/c++ and visual basic seems easy enough,besides there is a lot of help online.
    I am using visual basic 2010.
    I have made half of the application and am facing a problem.
    I have three forms so far in my project with possibly more to come but the problem is that when i run the exe file and close it after i'm done , i can still see it in the task manager and when i run it in the software itself and close it, i have to stop debugging manually everytime!
    shouldn't that be automatically done each time i close??

    please help i even tried putting a close button with me.close() command but it doesn't seem to help!
     
  2. peterpaulrubens2011

    peterpaulrubens2011 New Member

    Joined:
    Jun 20, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Application.Exit() and Environment.Exit() all could implement this. There are also some differences between them. For more information, you could read this link:
    p://geekswithblogs.net/mtreadwell/archive/2004/06/06/6123.aspx
     
  3. kpsg25690

    kpsg25690 New Member

    Joined:
    Aug 28, 2009
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    thanks peterpaulrubens2011
    i used Application.Exit() in the close buttons and it works great now but i still have the same problem if i use the close button of the window instead of the one included on the form itself.
    can i use the application.exit() when the close button on the window is clicked or is there any other way i can accomplish this?

    Thanks in advance..
     
  4. ManzZup

    ManzZup New Member

    Joined:
    May 9, 2009
    Messages:
    278
    Likes Received:
    43
    Trophy Points:
    0
    Occupation:
    Production Manager:Software @ ZONTEK
    Location:
    Sri Lanka
    Home Page:
    you can put your code into
    form1_formclosing event

    but this cannot be possible as i didnt get this kind of error so far
    i think what you are doing is something like calling a second form from the first form hiding the first and then closing the second form
    but in vb you are needed to close the Main form to stop executing the program
    in the form closing event of the other programs
    put something like form1.close()
     
  5. kpsg25690

    kpsg25690 New Member

    Joined:
    Aug 28, 2009
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    thanks
    yes ,i am calling form 2 from form 1 and hiding form 1.i'll try what you suggested and post the result..
     

Share This Page