Application.Exit VS Me.Close()

I

Ivan Weiss

I am wondering what the differences are between using the
Application.Exit() and Me.Close() (Me.Close on the main mdiForm in my
app) to close and exit my application.

Are there benefits to using either or...

Also, the standard three windows buttons on the top right (minimize,
restore/maximize, and close). My close button is not working in my app.
Does anyone know how to code this? I thought this was automatically
controlled by the designer when you create a form.

-Ivan
 
H

Herfried K. Wagner [MVP]

* Ivan Weiss said:
I am wondering what the differences are between using the
Application.Exit() and Me.Close() (Me.Close on the main mdiForm in my
app) to close and exit my application.

Are there benefits to using either or...

IMO it's preferred to use the 'Close' method. Have a look at the
documentation for 'Application.Exit' to find out why it is not suitable
in most cases,
Also, the standard three windows buttons on the top right (minimize,
restore/maximize, and close). My close button is not working in my app.
Does anyone know how to code this? I thought this was automatically
controlled by the designer when you create a form.

Maybe the famous "form close bug"?

C# code to repro the close bug:

<http://www.jelovic.com/binaries/WindowsFormsCloseBugDemo.zip>

Some information on the bug:

<http://makeashorterlink.com/?T2FC26194>

Fixed in .NET 1.1.
 

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