DataTable customerTable = new DataTable();
customerTable.Columns.Add("clsCustomerID", typeof(string)); //定义列类型
customerTable.Columns.Add("clsCustomerNM", typeof(string));
DataRow row= customerTable.NewRow(); //加一行
row["clsCustomerID"] = "01.2136";
row["clsCustomerNM"] = "MAXIS1";
customerTable.Rows.Add(row);
DataRow row1= customerTable.NewRow(); //加另一行
row1["clsCustomerID"] = "01.2255";
row1["clsCustomerNM"] = "VSC2_PRE_W1";
customerTable.Rows.Add(row1);
comboBox1.DataSource= customerTable; //设置datasource 和 显示和实际数据列
comboBox1.DisplayMember= "clsCustomerNM";
comboBox1.ValueMember= "clsCustomerID";
Copyright © 2009-2022 www.kswsj.com 成都快上网科技有限公司 版权所有 蜀ICP备19037934号