Sponsored By
Advertise with Us
Advertisement
Advertise with Us
Follow Us
Article
Forum
Blog
Quiz
Beginner
Careers
Contact
Login
Email Id
Password
Remember Me
Forgot Password?
Sign Up
Home
|
Product
|
Services
|
About Us
|
Interview
|
DeveloperSection
|
Submit an Article
|
Submit Blog
Report Abuse Form
Reason:
Home
>>
.Net
>>
C#
>>
Result of clicking No button on a MessageBox dialog class.
Author
Post
Awadhendra Tiwari
Total Post:
126
Member Since:
1/19/2011
Points:
893
Result of clicking No button on a MessageBox dialog class.
Posted On:
8/24/2011 1:13:19 AM
Report Abuse
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.
Thanks.
Reply
Author
Post
James Smith
Total Post:
48
Member Since:
3/16/2011
Points:
270
Re: Result of clicking No button on a MessageBox dialog class.
Posted On:
8/24/2011 6:16:55 AM
Report Abuse
Hi Awadhendra,
You can use DialogResult property for solving your problem. Like in following algorithm I will explain it.
if(MessageBox.Show("Click","Confirmation",MessageBox.OKCancel,MessageBoxIcon.Warning)==DialogResult.OK)
{
//Write code if OK button is clicked.
}
else
{
//Write code if other button is clicked.
}
Thanks.
Reply
Report Abuse Form
Reason:
Total Online Users:
7201
Advertisement
Advertise with Us
Copyright ©
2013
MindStick. All Rights Reserved.
Home
|
Contact Us
|
Services
|
Feedback
|
Advertisement
|
Privacy Policy
|
Term & Conditions
|
About Us