By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,035 Members | 1,543 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,035 IT Pros & Developers. It's quick & easy.

Using End()

P: n/a
I'm relatively new to this group so I apologize if this topic has been tossed around
before. I'm transitioning from VB6 to VB.net and I've been reading and working through
examples in a Microsoft Press book. In all of the examples the author uses End() to exit
the program. In VB6 it is unacceptable to use End because the program suddenly terminates
and no "clean up" occurs. In VB6 I use code like:

Private Sub cmdClose_Click()
Unload Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Dim f As Form
For Each f In Forms
Unload f
Set f = Nothing
Next
End Sub

Is there anything similar in .Net or is the use of End() acceptable?

Jim Edgar
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Jim Edgar" <dj***********@cox.net> schrieb:
I'm relatively new to this group so I apologize if this topic has been
tossed around
before. I'm transitioning from VB6 to VB.net and I've been reading and
working through
examples in a Microsoft Press book. In all of the examples the author
uses End() to exit
the program. In VB6 it is unacceptable to use End because the program
suddenly terminates
and no "clean up" occurs. In VB6 I use code like:

Private Sub cmdClose_Click()
Unload Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Dim f As Form
For Each f In Forms
Unload f
Set f = Nothing
Next
End Sub

Is there anything similar in .Net or is the use of End() acceptable?


You'll have to close your forms by calling their 'Close' method. Normally,
closing the main form (the form the application's message pump is associated
with) will close the application, and cleanup code will be executed. I
would try not to use 'End' because it gives you few control about what's
done when exiting your application -- in other words, the reasons to avoid
using 'End' in VB still apply to VB.NET.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2

P: n/a
Thank you.
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.