zoukankan      html  css  js  c++  java
  • MessageBox的Buttons和三级联动

    一、MessageBox的Buttons

     MessageBox.Show可以出现有按钮的对话框

    例如:

    DialogResult dr = MessageBox.Show("是否要继续吗?", "警告!!!", MessageBoxButtons.OKCancel);//它弹出的对话框如下图所示
    if (dr == DialogResult.OK)//只有按下确定按钮才执行下面
    {
    label1.Text = "天气不错";
    }

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

    二、三级联动

    三个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());
    }

    DateTime类型比较大小:

     DateTime.Compare(t1,t2)比较两个日期大小,排前面的小,排在后面的大,比如:2011-2-1就小于2012-3-2
    返回值小于零:  t1 小于 t2。 
    返回值等于零 : t1 等于 t2。 
    返回值大于零:  t1 大于 t2。 
  • 相关阅读:
    spark shuffle过程分析
    Android实现网络多线程断点续传下载
    幻世(OurDream)TM 2D图形引擎开通捐赠渠道
    MDA模型定义及扩展
    STL在迭代的过程中,删除指定的元素
    c# POST和GET方式通过server地址提交数据
    Python爬虫抓取csdn博客
    Word Ladder II
    HDU 4183 Pahom on Water(最大流SAP)
    poj1011 Sticks
  • 原文地址:https://www.cnblogs.com/zblc2016/p/5910595.html
Copyright © 2011-2022 走看看