How to find out what forms are open from main menu of app.

  • Thread starter Thread starter Hy-Vee Developer
  • Start date Start date
H

Hy-Vee Developer

I have a main menu w/ folder Icons that are closed. Once
the user clicks on a folder it opens and a new screen
pops up next to the main menu. When they close the form
I'd like the folder on the main menu to close but if they
leave the screen open and go back to the main menu I want
the folder to remain open. How do I figure out if the
form is still open or not once the focus is back on the
main menu? I've tried the .visible but that did not
work. Help?!?!??!?!
 
You could register for the Form.Closed event for each for you open
inside the main menu (is it a treeview?) and then you only make a
folder look closed when you recienve a "Closed" event.

for example (hand written so may not compile):

private void OpenForm()
{
MyForm f = new MyForm();
f.Closed+=new EventHandler(OnFormClose);
f.Show();
}

private void OnFormClose(object sender,EventArgs e)
{
MyForm f = (MyForm)sender;
//Find out what folder needs closing
if(f.Caption=="My wanted caption")
{
//whatever you need to do here
MakeFolderLookClosed(f,caption)
}
}
 
Back
Top