去评论
推扬网

MessageBox的Buttons和三级联动效果

admin
2020/04/11 13:34:45

这篇文章主要介绍了MessageBox的Buttons和三级联动的相关资料,非常不错,具有参考借鉴价值,需要的朋友可以参考下

一、MessageBox的Buttons

除此之外MessageBoxButtons还有好几种对话框

二、三级联动

三个Combobox

[code]public Form1()// Form1的构造函数
{
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);//数据源
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());
}[/code]

DateTime类型比较大小:

DateTime.Compare(t1,t2)比较两个日期大小,排前面的小,排在后面的大,比如:2011-2-1就小于2012-3-2

返回值小于零: t1 小于 t2。

返回值等于零 : t1 等于 t2。

返回值大于零: t1 大于 t2。

以上所示是小编给大家介绍的MessageBox的Buttons和三级联动,希望对大家有所帮助,如果大家有任何问题欢迎给我留言,小编会及时回复大家的!