|
Question : Forms closing ??
|
|
Hi expert,
My application (formMain) have many buttons : btnA, btnB, btnC ... btnZ .. If I click on btnA, the application will show formA (Show() Method), click on btnB, it will show formB ....
And My application has a button : btnCloseAll. When I click btnCloseAll, so all forms are showing will close.
I need a solution for btnCloseAll
Thanks and regards
|
|
Answer : Forms closing ??
|
|
Oh my god, I thought you should be able to convert.
private void Button2_Click(object sender, System.EventArgs e) { for (int i = My.MyApplication.Application.OpenForms.Count - 1; i >= 0; i--) { if (My.MyApplication.Application.OpenForms[i] != this) { My.MyApplication.Application.OpenForms[i].Close(); } } }
|
|
|
|