• comboBox加载数据


    private void button2_Click(object sender, EventArgs e)
            {
                comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
                comboBox1.Items.Add("云南");
                comboBox1.Items.Add("上海");
                Class1 c1 = new Class1();
                c1.Id = "01";
                c1.Name = "云南01";
                Class1 c2 = new Class1();
                c2.Id = "02";
                c2.Name = "上海02";
                List<Class1> clist= new List<Class1>();
                clist.Add(c1);
                clist.Add(c2);
                comboBox1.DataSource = clist;
                comboBox1.DisplayMember = "Name";
                comboBox1.ValueMember = "Id";




            }

            private void button3_Click(object sender, EventArgs e)
            {
                if (comboBox1.SelectedValue== null)
                {
                    MessageBox.Show("combox里面没有值");
                }
                else
                {
                    MessageBox.Show(comboBox1.Text + "/" + comboBox1.SelectedValue.ToString());

                }
               
            }

  • 相关阅读:
    tornado与asyncmongo
    Grails/Groovy学习资源
    关于markdown
    Grails一些重要的配置文件
    Grails的目录结构
    Grails中的UrlMapping
    MVC已死,该是用MOVE的时候了
    算法——回溯法
    算法——分支限界法
    C#如何操控FTP
  • 原文地址:https://www.cnblogs.com/mljqqh/p/7003910.html
Copyright © 2020-2023  润新知