Share via


how to exit Application in vb .net

Question

Thursday, December 9, 2010 12:33 PM | 1 vote

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

All replies (8)

Thursday, December 9, 2010 12:58 PM ✅Answered | 1 vote

Use

End()

to end the application.

Regards,

Maverick.


Thursday, December 9, 2010 1:14 PM ✅Answered | 2 votes

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 12:55 PM

Try

Me.Close()

Thursday, December 9, 2010 1:05 PM | 2 votes

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 2:01 PM

Good to know, Thank you vary much for the info John.


Thursday, February 18, 2016 10:39 PM

Tnx so much. There are so many forums discussing this subject, none of which worked for me. Yours did.


Thursday, February 18, 2016 11:11 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


Tuesday, April 30, 2019 1:55 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