重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
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";