Getting out from OnLoad event on a form.

  • Thread starter Thread starter Emmanuel_
  • Start date Start date
E

Emmanuel_

..NET Framework 1.1


Hi

I' m wondering what is the best method to close a form while executing code
on the Load event.

For example:
While setting up some controls on the Load event, we discover that something
is wrong and we need to Close and Dispose the Form.

What is the best way to do this ?

Thanks
Emmanuel
 
I would use the Me.Close() method. It also disposes off all resources.

Note, however that if this is the Startup Form, then the effect will be
same as calling Application.Exit().

Regards,

Cerebrus.
 
Back
Top