I have the following code:
private void button1_Click(object sender, EventArgs e)
{
var answer =
MessageBox.Show(
\"Do you wish to submit checked
You're performing a lengthy operation on the UI thread. You should move it to a background thread (via BackgroundWorker for instance) so the UI thread can do things like repaint the screen when needed. You can cheat and execute Application.DoEvents, but I'd really recommend against it.
This question and answer are basically what you're asking:
Form Not Responding when any other operation performed in C#