PC Review


Reply
Thread Tools Rate Thread

Application.Exit or End

 
 
Pete Smith
Guest
Posts: n/a
 
      30th Jan 2006
Which is the appropriate one to use in the above choice?
VB.Net. .Net Framework 1.1
Thank you,
Pete


 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      30th Jan 2006
Pete Smith wrote:
> Which is the appropriate one to use in the above choice?
> VB.Net. .Net Framework 1.1
> Thank you,
> Pete
>
>


As far as I know both should be avoided unless you have a specific
reason to use it. In most cases closing the forms will exit the
program. Why are you trying to use either?

chris
 
Reply With Quote
 
Pete Smith
Guest
Posts: n/a
 
      30th Jan 2006
My understating is by calling the above statements will close the
application properly. Like releasing all the resources.... etc.

That is the reason why I am calling the above statements.

Pete


"Chris" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Pete Smith wrote:
> > Which is the appropriate one to use in the above choice?
> > VB.Net. .Net Framework 1.1
> > Thank you,
> > Pete
> >
> >

>
> As far as I know both should be avoided unless you have a specific
> reason to use it. In most cases closing the forms will exit the
> program. Why are you trying to use either?
>
> chris



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      30th Jan 2006
"Pete Smith" <(E-Mail Removed)> schrieb:
> My understating is by calling the above statements will close the
> application properly. Like releasing all the resources.... etc.
>
> That is the reason why I am calling the above statements.


Both will release resources, but custom cleanup code may not be executed!
Could you describe the design of your application in more detail and where
you are calling 'End'/'Application.Exit'?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

 
Reply With Quote
 
Ken Halter
Guest
Posts: n/a
 
      30th Jan 2006
"Pete Smith" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> My understating is by calling the above statements will close the
> application properly. Like releasing all the resources.... etc.
>
> That is the reason why I am calling the above statements.
>
> Pete


If the .Net version of 'End' works anything like the VB6 version, use
anything else. In VB6, sure, it stops the app but in a way that's similar to
shutting your car off while driving. iow, it "yanks the plug" on the app,
possibly leaving automation objects hanging around waiting for task manager
intervention.

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..


 
Reply With Quote
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      31st Jan 2006
What do you do if you start you application from a sub main and open a form
within sub main?
--
Dennis in Houston


"Chris" wrote:

> Pete Smith wrote:
> > Which is the appropriate one to use in the above choice?
> > VB.Net. .Net Framework 1.1
> > Thank you,
> > Pete
> >
> >

>
> As far as I know both should be avoided unless you have a specific
> reason to use it. In most cases closing the forms will exit the
> program. Why are you trying to use either?
>
> chris
>

 
Reply With Quote
 
Pete Smith
Guest
Posts: n/a
 
      31st Jan 2006
Application is basically gets the data from the database and prints in a
particualr format. When the user clicks the "Exit" button or "X" on the
right top of the windows form, the application will close.
Thank you,
Pete
..



"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Pete Smith" <(E-Mail Removed)> schrieb:
> > My understating is by calling the above statements will close the
> > application properly. Like releasing all the resources.... etc.
> >
> > That is the reason why I am calling the above statements.

>
> Both will release resources, but custom cleanup code may not be executed!
> Could you describe the design of your application in more detail and where
> you are calling 'End'/'Application.Exit'?
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://classicvb.org/petition/>
>



 
Reply With Quote
 
CMM
Guest
Posts: n/a
 
      31st Jan 2006
"Dennis" <(E-Mail Removed)> wrote in message
news:EB1DF272-5997-4A01-A8DA-(E-Mail Removed)...
> What do you do if you start you application from a sub main and open a
> form
> within sub main?


You close the form (Unload Me).


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      31st Jan 2006
"Pete Smith" <(E-Mail Removed)> schrieb:
> Application is basically gets the data from the database and prints in a
> particualr format. When the user clicks the "Exit" button or "X" on the
> right top of the windows form, the application will close.


Simply call 'Me.Close()' inside the form instead of calling 'End' or
'Application.Exit'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      31st Jan 2006
Pete,

In C# (and other languages) is used a Shared Sub Main as starting point of a
program

In VB Net as in VB6 you have the choise between using that Sub Main or using
the inbuild one in your main-form. (Herfried uses forever that Sub Main in
his samples, I use forever that MainForm (form1).

You would never use End for the reason as Ken Halter has explained.

With a Sub Main you would use
application.exit

With a mainform you would use
me.close

I hope this helps,

Cor


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.Exit() vs Environmrnt.Exit(0) =?Utf-8?B?VGFvZ2U=?= Microsoft C# .NET 1 19th Apr 2007 03:37 AM
application.exit, application.exitthread exit application problem =?Utf-8?B?TWlrZSBTaWx2ZXI=?= Microsoft Dot NET Framework Forms 2 24th Nov 2004 03:14 AM
Application.exit() vs Environment.exit(-1) vs Application.exitthread() Brendan Miller Microsoft C# .NET 1 5th Feb 2004 08:13 AM
RE: How can I safe exit my application when the user terminates the application from the Control panel? Dolphin White Microsoft Dot NET Compact Framework 3 6th Sep 2003 01:12 AM
RE: RE: How can I safe exit my application when the user terminates the application from the Control panel? Dolphin White Microsoft Dot NET Compact Framework 0 4th Sep 2003 04:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:29 PM.