Ending the appliation reliably

  • Thread starter Thread starter Adam Honek
  • Start date Start date
A

Adam Honek

Hi all,

Is it safe to use application.exit or application.exitthread to end a
program in .NET?

If we didn't use the forms designer then there isn't any generated code to
dispose of controls upon termination, would the above clear any resources
up?

Also, what if we have a multi-thread app?

Perhaps it's better to use the API? Maybe TerminateProcess???

Adam
 
Adam,

The best Net programs are withouth any API. When you had looked at the
beginning in this newsgroup, it were all answers with API's. Given by VB6
guys/girls. Now you don't see them almost not anymore (they can be needed in
some cases)

In fact you don't have to set anything to close your application, the user
does it with pushing the cross. While mostly the me.close from the mainform
does it if you want to forsce this.

The settup setting in your project properties tells how you start your
project. This setting is a little bit different for the version 2002/2003
and 2005. Easier but more confusing in the first one.

In a sub main class, the logic goes normally just to an end.

One of the main points of managed code is to release all used managed
recourses.

I hope this helps,

Cor
 
Back
Top