directxBOB
asked on
Easiest Way to close a Window
I have a window, that has a close button, I would like to make it close. So I have the method:
private void m_CloseButton_Click(object sender, System.EventArgs e)
{
components.Dispose();
}
is Components.Dispose();
The easiest way or is there another way?
private void m_CloseButton_Click(object
{
components.Dispose();
}
is Components.Dispose();
The easiest way or is there another way?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
this.Dispose();
--pradeep
--pradeep
Hi tyr this
using System.Threading;
and add
Thread.CurrentThread.Abort ();
--pradeep
using System.Threading;
and add
Thread.CurrentThread.Abort
--pradeep
what do you wanna close? only a specific form or the whole application with different forms?
You can also use Application.Exit(); but in that case the form_Close and form_Closing events are NOT triggered so be carefull with this as code won't be executed in these events.
hth