Getting out from OnLoad event on a form.

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
 
C

Cerebrus

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top