none
how to exit Application in vb .net RRS feed

  • Question

  • I have written a program in which I have import

     

    Imports

     

    Now when I write Application.Exit()

     

    It show error

    Exit is not a member of Microsoft.Office.Interop.Outlook

    what should I do.

    Tell me solution for this

     

     

    Microsoft.Office.Interop.Outlook
    Thursday, December 9, 2010 12:33 PM

Answers

All replies

  • Try

    Me.Close()
    Thursday, December 9, 2010 12:55 PM
  • Use

    End()

    to end the application.

    Regards,

    Maverick.

    Thursday, December 9, 2010 12:58 PM
  • Try

    Me.Close()


    Hi WickedTackleBox,

    Me.Close()

    is okay if you only have a one Form application.

    If you use Me.Close()

    say on Form2 then Form2 will close.

    The usual setting is for the application to close on Form1 closing which is the usual "Startup Form "

    If you select the last item in the PROJECT   menu then click on the APPLICATION   tab on the left of the

    window that appears you will see an option to change this to "When last Form closes " under ShutDown Mode .

    Just thought you might like the extra info.  ;-)

     



    Regards,

    John

    Click this link to see how to insert a picture into a forum post.
    Thursday, December 9, 2010 1:05 PM
  • I have written a program in which I have import

     

    Imports

     

    Now when I write Application.Exit()

     

    It show error

    Exit is not a member of Microsoft.Office.Interop.Outlook

    what should I do.

    Tell me solution for this

     

     

    Microsoft.Office.Interop.Outlook

    Hi,

    For a Windows Forms based application and I think CONSOLE applications you do not need an IMPORTS statement for

    Application.Exit()

    It is available from 2003 versions and Framework 1.1 onwards. See.>>

    http://msdn.microsoft.com/en-us/library/system.windows.forms.application.exit%28VS.71%29.aspx

    Use it like this.>>

     

     

    Public Class Form1
    
     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
      Application.Exit()
    
     End Sub
    End Class

     

     



    Regards,

    John

    Click this link to see how to insert a picture into a forum post.
    Thursday, December 9, 2010 1:14 PM
  • Good to know, Thank you vary much for the info John.

    Thursday, December 9, 2010 2:01 PM
  • Tnx so much. There are so many forums discussing this subject, none of which worked for me. Yours did.
    Thursday, February 18, 2016 10:39 PM
  • I see here market as answer for an Windows Forms Applicartion, Application Exit. 

    That is not the case, the application is started behind the scene and will automatically do Application Exit when the form closes. 

    I also see here used "End" that means that the program direct ends and leaves all garbage in memory. Let say the ultimate way to get memory leaks.

    In other words only programs which are started with application.start should be ended with application.exit if that is not done the end automatically with the last statement.


    Success
    Cor


    • Edited by Cor Ligthert Thursday, February 18, 2016 11:12 PM
    Thursday, February 18, 2016 11:11 PM
  • If the developer wanted to stop completely, please use

    the command END 

    or you need to exit from module or application

    use the command   ME.CLOSE

    OR

    Application.exit

    OR

    EXIT SUB ' to exit the subroutine

    or

    use the command STOP

     
    Tuesday, April 30, 2019 1:55 PM