schenkp
asked on
How to kill a form
HI,
If i have a couple of forms open and i would like them to close when the user clicks on a button on the main form, what the best way to do this?
If i have a couple of forms open and i would like them to close when the user clicks on a button on the main form, what the best way to do this?
On the main form keep a reference to the forms you wish to close then when the user clicks on the button do ReferenceToForm.Close(); Where the ReferenceToForm is the variable name used to reference the form you created.
vb.net 2003 does not seem to have a forms collection like vb6, while vb.net 2005 does have it:
http://www.dotnet247.com/247reference/msgs/21/107856.aspx
http://www.vbforums.com/showthread.php?t=387971
in depending on the version you are, you will have to manage all your forms, or be able to use
My.Application.OpenForms
http://www.dotnet247.com/247reference/msgs/21/107856.aspx
http://www.vbforums.com/showthread.php?t=387971
in depending on the version you are, you will have to manage all your forms, or be able to use
My.Application.OpenForms
Hi schenkp,
Are your forms children? In this case, you can go through the MDIChildren collection:
For Each frmChild As Form In Me.MdiChildren
frmChild.Close()
Next
Cheers!
Are your forms children? In this case, you can go through the MDIChildren collection:
For Each frmChild As Form In Me.MdiChildren
frmChild.Close()
Next
Cheers!
ASKER
Cant get this to work, here is the code i am using, its get launched when a user selects the menu option...
EC45 ec4 = new EC45();
ec4.Show();
ec4.PlayMedia(@"C:\\music. mp3");
ec4.Owner = this;
There is a timer in the program and when it counts down to zero I am trying to close EC45 form and its not working?
EC45 ec4 = new EC45();
ec4.Show();
ec4.PlayMedia(@"C:\\music.
ec4.Owner = this;
There is a timer in the program and when it counts down to zero I am trying to close EC45 form and its not working?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.