Home > DeveloperSection > Forums > Result of clicking No button on a MessageBox dialog class.
Awadhendra Tiwari

Total Post:126

Posted on    August-24-2011 1:13 AM

 C# C# 

 1 Reply(s)
 1227  View(s)
Rate this:
Hi all,
I have a following line of code
MessageBox.Show("Are you sure you want to download? Click 'YES' to Import (or) 'NO' to cancel", "Confirmation Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

I am trying to set it so that if the user clickes no, then it goes back to the original form and sets a button to visible and a label to invisible. I know the code to take care of the button and label, but I'm not sure how to take care of the result of the No button click.

Any help could be appreciated.

James Smith

Total Post:48

Posted on    August-24-2011 6:16 AM

Hi Awadhendra,

You can use DialogResult property for solving your problem. Like in following algorithm I will explain it.

        //Write code if OK button is clicked.
      //Write code if other button is clicked.


Don't want to miss updates? Please click the below button!

Follow MindStick