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 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.