Jump to content

Form Closing

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
AlexanderM

AlexanderM

    Newbie

  • Members
  • Pip
  • 2 posts
Hi.

Im curently coding a program were I need to shutdown only the one of the forms I have open.
I have tried :

Application.Exit();


This.Close();

Both closed all my windows.

Alexander M

#2
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Alexander,

If you use something like Application.Exit(), it will shut down the whole program. However, this.Close() should only hide the current form.

The reason this is happening is because the current form you are closing is also the main form, or the form that you first loaded with. To change this in a .NET program, there is an option somewhere in the Properties section of the whole project, where you can change this behaviour. In PHP, the process may be different, but look for an option that defines when the application closes. This may be set to something like "When First Form Closes", so change this to "When All Forms Are Closed" or something along those lines.