一、MessageBox的Buttons
MessageBox.Show可以出現(xiàn)有按鈕的對話框
例如:
DialogResult dr = MessageBox.Show("是否要繼續(xù)嗎?", "警告!!!", MessageBoxButtons.OKCancel);//它彈出的對話框如下圖所示if (dr == DialogResult.OK)//只有按下確定按鈕才執(zhí)行下面{label1.Text = "天氣不錯";}
除此之外MessageBoxButtons還有好幾種對話框
二、三級聯(lián)動
三個Combobox
public Form1()// Form1的構(gòu)造函數(shù){InitializeComponent();AreaDataBind(comboBox1, "0001");AreaDataBind(comboBox2, comboBox1.SelectedValue.ToString());AreaDataBind(comboBox3, comboBox2.SelectedValue.ToString());}public void AreaDataBind(ComboBox cb, string Pcode){cb.DataSource = new ChinaData().Select(Pcode);//數(shù)據(jù)源cb.DisplayMember = "AreaName";//顯示值cb.ValueMember = "AreaCode";//實際值}private void comboBox1_SelectedIndexChanged(object sender, EventArgs e){AreaDataBind(comboBox2, comboBox1.SelectedValue.ToString());}private void comboBox2_SelectedIndexChanged(object sender, EventArgs e){AreaDataBind(comboBox3, comboBox2.SelectedValue.ToString());}DateTime類型比較大小:
DateTime.Compare(t1,t2)比較兩個日期大小,排前面的小,排在后面的大,比如:2011-2-1就小于2012-3-2
返回值小于零: t1 小于 t2。
返回值等于零 : t1 等于 t2。
返回值大于零: t1 大于 t2。
以上所示是小編給大家介紹的MessageBox的Buttons和三級聯(lián)動,希望對大家有所幫助,如果大家有任何問題歡迎給我留言,小編會及時回復(fù)大家的!
新聞熱點
疑難解答
圖片精選