C# question

Good morning everyone.
I know this forum is for C++ but, I have a quick C# question for you. If, you have multiple windows open in a C# program is there a simple line of code to close them all?

For example, say I have a windows form open and from that form I use the following code behind my SubmitButton.

1
2
3
4
5
6
7
8
9
10
11
  private void SubmitButton_Click(object sender, EventArgs e)
        {
            this.Hide();
            AssignmentResult AssignmentR = new AssignmentResult();
            AssignmentR.Show();
            textBox1.Text = "";
            comboBox1.Items.Clear();
            comboBox2.Items.Clear();
            comboBox3.Items.Clear();
            textBox3.Text="";
        }


Now the front page hides and the new page is displayed. This works GREAT! Only problem is, when I use my Exit button with the code

1
2
3
4
        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }


It will only close the open window and not close the entire application. Any help will be greatly appreciated.
Can't you just call Exit() on the main application object?

and yes, this is a c++ forum, you might get more replies on a .net forum :)
Topic archived. No new replies allowed.