MessageBox usage Daquan in C #

Source: Internet
Author: User

We often use the MessageBox in our programs.

MessageBox.Show () has a total of 21 overloaded methods. The common usage is summarized as follows:

1.messagebox.show ("hello~~~~");

The simplest is to display only the prompt information.

2.messagebox.show ("There is something wrong!", "ERROR");

You can add a caption to a message box.

3.if (MessageBox.Show ("Delete this user?", "Confirm Message", messageboxbuttons.okcancel) = = DialogResult.OK)

{

Delete

}

This is used when asking whether or not to delete.

4.if (MessageBox.Show ("Delete this user?", "Confirm Message", messageboxbuttons.okcancel,messageboxicon.question) = = DialogResult.OK)

{

Delete

}

You can add a icon,.net to the MessageBox to provide common icon co-selection.

5.if (MessageBox.Show ("Delete this user?", "Confirm Message", Messageboxbuttons.okcancel, Messageboxicon.question, Messageboxdefaultbutton.button2) = = DialogResult.OK)

{

Delete

}

You can change the default focus of the MessageBox, as follows:

6.if (MessageBox.Show ("Delete this user?", "Confirm Message", Messageboxbuttons.okcancel, Messageboxicon.question, messageboxdefaultbutton.button2,messageboxoptions.rtlreading) = = DialogResult.OK)

{

Delete

}

Reverse Display:

7.if (MessageBox.Show ("Delete this user?", "Confirm Message", Messageboxbuttons.okcancel, Messageboxicon.question, Messageboxdefaultbutton.button2, messageboxoptions.rightalign,true) = = DialogResult.OK)

{

Delete

}

Add the Help button:

8.if (MessageBox.Show ("Delete this user?", "Confirm Message", Messageboxbuttons.okcancel, Messageboxicon.question, Messageboxdefaultbutton.button1, messageboxoptions.rtlreading, @ "/folder/file.htm") = = DialogResult.OK)

{

Delete

}

Specify the path to the Help file and click to open the Help file under that path.

9.//helpnavigator specifies a constant to indicate the Help file element to display. The Find Help file opens to the search page.

if (MessageBox.Show ("Delete this user?", "Confirm Message", Messageboxbuttons.okcancel, Messageboxicon.question, Messageboxdefaultbutton.button1, messageboxoptions.rtlreading, @ "/folder/file.htm", HelpNavigator.Find) = = DialogResult.OK)

{

Delete

}

There are some usages, not too useful here is not introduced, interested friends can refer to the following: MSDN's MessageBox class.

MessageBox usage Daquan in C #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.