blah blah blah is here! blah blah » Close

up1down
link

hello ,

i have tow questions :

1 - i want code to close all forms

like

closeAllForms();


2 - i want code like this

this.Button1.Click();

last answered 2 years ago

1 answers

link

If you want to close all forms and quit the application immediately, I'd just call Application.Exit().

To press a button programatically you can use button1.PerformClick().

king_888
153

thank you it's work good but how i can but it in Form1_UnLoad

vulpes
17279

If you mean the Form1_FormClosed eventhandler (there's no Unload event in .NET), then there's no need to put any code in there because if someone closes the start up form (normally Form1) it will automatically close all the other forms as well and terminate the application.

Feedback