|
-
Oct 5th, 2003, 06:29 PM
#1
Thread Starter
Addicted Member
End Command
What is the difference between End and Me.Close from what I was told in VB6 the Unload Me was the proper way of unloading a form.
Someone care to explain?
Thanks!
-
Oct 5th, 2003, 07:33 PM
#2
Frenzied Member
What 'End' you are talking about?
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Oct 5th, 2003, 11:37 PM
#3
Thread Starter
Addicted Member
sorry! should have made myself more clear
Code:
Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
Me.Close()
End Sub
or
Code:
Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
End
End Sub
-
Oct 5th, 2003, 11:43 PM
#4
Frenzied Member
Me.Close closes the current form, if this form controls the life cycle of the application then the application is closed too, but End terminates execution immediately.
Remarks from MSDN
The End statement can be placed anywhere in a procedure to end code execution, close files opened with an Open statement, and clear variables. The End statement calls the Exit method of the Environment class in the System namespace. System.Environment.Exit requires that you have SecurityPermissionFlag.UnmanagedCode permissions. If you do not, a SecurityException error occurs.
When executed, the End statement clears all variables at module and class level and all static local variables in all modules.
Note The End statement stops code execution abruptly, without invoking the Finalize method or any other Visual Basic code. Object references held by other programs are invalidated.
The End statement provides a way to force your program to halt. Your program closes as soon as there are no other programs holding references to its objects and none of its code is executing.
If your application has any forms open, you should close them before executing End. A console application can either use End or simply return from the Main procedure.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Oct 6th, 2003, 04:54 AM
#5
Sleep mode
-
Oct 7th, 2003, 06:52 AM
#6
Fanatic Member
There is also:
Application.ExitThread()
Environment.Exit(-1)
System.Threading.Thread.CurrentThread.Abort()
Just to confuse even more!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|