主题:请教:关于comboBox
有代码如下:
private void Form_Load(object sender, EventArgs e)
{
DataTable dtSex = new DataTable();
dtSex.Columns.Add("Value");
dtSex.Columns.Add("Name");
DataRow drSex;
drSex = dtSex.NewRow();
[color=FF0000]drSex[0] = "5";[/color]
drSex[1] = "男";
dtSex.Rows.Add(drSex);
drSex = dtSex.NewRow();
[color=FF0000]drSex[0] = "8";[/color]
drSex[1] = "女";
dtSex.Rows.Add(drSex);
//cmb_Temp为comboBox下拉列表框
cmb_Temp.ValueMember = "Value";
cmb_Temp.DisplayMember = "Name";
cmb_Temp.DataSource = dtSex;
cmb_Temp.DropDownStyle = ComboBoxStyle.DropDownList;
}
请教各位:
在下拉列表(cmb_Temp)的SelectedIndexChanged事件中能否获取 性别“男”所对应的5 和 性别“女”所对应的8 ,如果可以获取,请指教一下,该应用哪个属性或者方法得到此值。
private void Form_Load(object sender, EventArgs e)
{
DataTable dtSex = new DataTable();
dtSex.Columns.Add("Value");
dtSex.Columns.Add("Name");
DataRow drSex;
drSex = dtSex.NewRow();
[color=FF0000]drSex[0] = "5";[/color]
drSex[1] = "男";
dtSex.Rows.Add(drSex);
drSex = dtSex.NewRow();
[color=FF0000]drSex[0] = "8";[/color]
drSex[1] = "女";
dtSex.Rows.Add(drSex);
//cmb_Temp为comboBox下拉列表框
cmb_Temp.ValueMember = "Value";
cmb_Temp.DisplayMember = "Name";
cmb_Temp.DataSource = dtSex;
cmb_Temp.DropDownStyle = ComboBoxStyle.DropDownList;
}
请教各位:
在下拉列表(cmb_Temp)的SelectedIndexChanged事件中能否获取 性别“男”所对应的5 和 性别“女”所对应的8 ,如果可以获取,请指教一下,该应用哪个属性或者方法得到此值。