Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error using Application.exit()

Status
Not open for further replies.

jeffmoore

Programmer
Aug 29, 2003
301
US
I'm new to vb. I'm trying to get my program to exit by using a button. The on_click calls the code below.
This code generates the error message show below at the line 'application.exit()':

If (MessageBox.Show("Exiting this application will stop data collection." & vbCrLf & "Are you sure you wish to exit?", "Warning...", MessageBoxButtons.YesNo) = DialogResult.Yes) Then
' The user wants to exit the application. Close everything down.
Application.Exit()

Error message:

An unhandled exception of type 'System.Security.SecurityException' occurred in mscorlib.dll

Additional information: Request for the permission of type System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.

 
This looks like VB.Net. In which case try Forum796
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top