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.