0

I have a message Box with two options, Retry or Cancel. Upon clicking cancel, I want to close the MessageBox and then load the main Form. Any idea how to do that? This function is already within a button_click function and I want to get out of this function and back to the Form_load.

void button_click(...)
{

dr=MessageBox.Show(.....);
if(dr== DialogResult.Cancel)
//exit the button and go back to the main form

}

4
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by DdoubleD
0

I have a message Box with two options, Retry or Cancel. Upon clicking cancel, I want to close the MessageBox and then load the main Form. Any idea how to do that? This function is already within a button_click function and I want to get out of this function and back to the Form_load.

void button_click(...)
{

dr=MessageBox.Show(.....);
if(dr== DialogResult.Cancel)
//exit the button and go back to the main form

}

Check out this
http://dotnetperls.com/messagebox-show
Hope its can help you...

0

I have a message Box with two options, Retry or Cancel. Upon clicking cancel, I want to close the MessageBox and then load the main Form. Any idea how to do that? This function is already within a button_click function and I want to get out of this function and back to the Form_load.

void button_click(...)
{

dr=MessageBox.Show(.....);
if(dr== DialogResult.Cancel)
//exit the button and go back to the main form

}

The MessageBox call works fine in the Form_Load method. If you are wanting to cancel that form's creation at that point to return to the calling form (main form?), you can call Close() method after checking DialogResult.Cancel .

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.