MessageBox's Buttons and three-level linkage,

Source: Internet
Author: User

MessageBox's Buttons and three-level linkage,

1. Buttons of MessageBox

MessageBox. Show can display a dialog box with buttons

For example:

DialogResult dr = MessageBox. Show ("do you want to continue? "," Warning !!! ", MessageBoxButtons. OKCancel); // the pop-up dialog box is shown in
If (dr = DialogResult. OK) // the following code is executed only when the OK button is pressed.
{
Label1.Text = "good weather ";
}

Besides MessageBoxButtons, there are several dialog boxes

Level 2 and Level 3 linkage

Three comboboxes

Public Form1 () // The constructor of Form1
{
InitializeComponent ();


AreaDataBind (combox1. "0001 ");
AreaDataBind (combox2, comboBox1.SelectedValue. ToString ());
AreaDataBind (combox3, comboBox2.SelectedValue. ToString ());
}

Public void AreaDataBind (ComboBox cb, string Pcode)
{
Cb. DataSource = new ChinaData (). Select (Pcode); // Data Source
Cb. DisplayMember = "AreaName"; // display the value
Cb. ValueMember = "AreaCode"; // actual value
}

Private void combobox#selectedindexchanged (object sender, EventArgs e)
{
AreaDataBind (combox2, comboBox1.SelectedValue. ToString ());
}

Private void comboBox2_SelectedIndexChanged (object sender, EventArgs e)
{
AreaDataBind (combox3, comboBox2.SelectedValue. ToString ());
}

DateTime type comparison size:

DateTime. Compare (t1, t2) compares the values of the two dates. The values are smaller than those of the preceding values, and the values are larger than those of the following values. For example, the values of 2011-2-1 are smaller than those of 2012-3-2.
Return Value Less Than Zero: t1 is less than t2.
Return value is equal to zero: t1 is equal to t2.
Return value greater than zero: t1 is greater than t2.

Related Article

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.