TunaAdmiral
MIS
Hi!
Here's my issue:
I have an application that utilizes two forms.
The first form hides itself shortly after startup, and invokes the second form.
Everything works great, except that I can't get the process to end when the user exits the application using the 'X' button in the upper-righthand corner of the second form, or the 'Close' option in the standard windows form menu in the upper-lefthand corner of the second form.
I added a File menu immediately beneath the title bar of the second form which includes an 'Exit' option. When the user clicks the 'Exit' option, I have an event that exits the application like this:
private void menuItem2_Click(object sender, System.EventArgs e)
{
this.Close();
Application.Exit();
}
This works just fine! In task manager, the application closes, as well as the associated thread.
Now, when the user uses the 'X' button in the upper-righthand corner of the form the application closes in task manager, but the thread will not end. I have added the following code to the Closing event of the form:
private void Browser_Closing(object sender, System.EventArgs e)
{
this.Close();
Application.Exit();
}
What am I doing wrong?
Any help would be appreciated.
Here's my issue:
I have an application that utilizes two forms.
The first form hides itself shortly after startup, and invokes the second form.
Everything works great, except that I can't get the process to end when the user exits the application using the 'X' button in the upper-righthand corner of the second form, or the 'Close' option in the standard windows form menu in the upper-lefthand corner of the second form.
I added a File menu immediately beneath the title bar of the second form which includes an 'Exit' option. When the user clicks the 'Exit' option, I have an event that exits the application like this:
private void menuItem2_Click(object sender, System.EventArgs e)
{
this.Close();
Application.Exit();
}
This works just fine! In task manager, the application closes, as well as the associated thread.
Now, when the user uses the 'X' button in the upper-righthand corner of the form the application closes in task manager, but the thread will not end. I have added the following code to the Closing event of the form:
private void Browser_Closing(object sender, System.EventArgs e)
{
this.Close();
Application.Exit();
}
What am I doing wrong?
Any help would be appreciated.