I have a bit of code that writes to a log file. If there's an error it writes the message to TextBox1:
catch (IOException exc)
AppendTextBox1(exc.Message + Environment.NewLine);
Now my problem is, I have another bit of code that's called when the program ends:
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
AppendLog("PROGRAM CLOSE" + Environment.NewLine);
Does TextBox1 still exist at this point? What happens if there's an error writing to the log file at this point. Does the program crash because TextBox1 might not exist anymore when AppendLog tries to write the error message to TextBox1?