ComboBox cb = new ComboBox();//新建combobox
System.Drawing.Point p2 = new Point(10, 10);//定坐标
DataTable dt_select = new DataTable();//新建datatable
dt_select.Columns.Add("Item");//增加item列
dt_select.Columns.Add("Value");//增加value列dt_select.Rows.Add(“no1”, 1);//插入数据
dt_select.Rows.Add(“no2”, 2);//插入数据
cb.DisplayMember = "Item";//item设为显示属性
cb.ValueMember = "Value";//value设为value属性
cb.DataSource = dt_select;//把数据集放入cb
cb.Location = p2;//定combobox坐标
panel1.Controls.Add(cb);//在panel1上放置combobox
cb.SelectedValue = 1;//设置初始选项, 这一步至关重要,一定要放在 panel1.Controls.Add(cb)之后,否则无法初始化选项