源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

MessageBox的Buttons和三级联动效果

  • 时间:2021-06-13 22:13 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:MessageBox的Buttons和三级联动效果
[b]一、MessageBox的Buttons[/b] MessageBox.Show可以出现有按钮的对话框 例如:
DialogResult dr = MessageBox.Show("是否要继续吗?", "警告!!!", MessageBoxButtons.OKCancel);//它弹出的对话框如下图所示
if (dr == DialogResult.OK)//只有按下确定按钮才执行下面
{
label1.Text = "天气不错";
}
[img]http://files.jb51.net/file_images/article/201611/201611141426416.png[/img] 除此之外MessageBoxButtons还有好几种对话框 [b]二、三级联动[/b] 三个Combobox
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());
}
[b]DateTime类型比较大小:[/b] DateTime.Compare(t1,t2)比较两个日期大小,排前面的小,排在后面的大,比如:2011-2-1就小于2012-3-2 返回值小于零: t1 小于 t2。 返回值等于零 : t1 等于 t2。 返回值大于零: t1 大于 t2。 以上所示是小编给大家介绍的MessageBox的Buttons和三级联动,希望对大家有所帮助,如果大家有任何问题欢迎给我留言,小编会及时回复大家的!
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部