1

I wrote the code below:

private void DisplayStartUps()
{
    Form2 dialog = new Form2();

    if (dialog.ShowDialog(this) == DialogResult.OK)
    {
        // Read the contents of testDialog's TextBox.
        totalTeams = dialog.NumOfTeams;
    }
    dialog.Dispose();
}

When the form 2 opens, then I click on the "red x" pn the top to close the form. I got the message:

TargetInvocationException was unhandled

What does that mean and how to fix it?

4

0 回答 0