1
//声明
2
public enum DefaultType : int
3
{
4
布料 = 1,
5
商标 = 2,
6
钢弓 = 4,
7
棉碗 = 8
8
}
9
//绑定到comboBox
10
comboBox3.DataSource =Enum.GetValues(typeof(Dal.Class1.DefaultType));
11
//取得comboBox选定值
12
private void comboBox3_Leave(object sender, EventArgs e)
13
{
14
Dal.Class1.DefaultType msa;
15
msa = (Dal.Class1.DefaultType)Enum.Parse(typeof(Dal.Class1.DefaultType),comboBox3.SelectedItem.ToString());
16
Dal.Class1.DefaultType type = msa;
17
int intType = (int)type;
18
MessageBox.Show(intType.ToString());
19
}
//声明2
public enum DefaultType : int3
{4
布料 = 1,5
商标 = 2,6
钢弓 = 4,7
棉碗 = 88
}9
//绑定到comboBox10
comboBox3.DataSource =Enum.GetValues(typeof(Dal.Class1.DefaultType));11
//取得comboBox选定值12
private void comboBox3_Leave(object sender, EventArgs e)13
{14
Dal.Class1.DefaultType msa;15
msa = (Dal.Class1.DefaultType)Enum.Parse(typeof(Dal.Class1.DefaultType),comboBox3.SelectedItem.ToString());16
Dal.Class1.DefaultType type = msa;17
int intType = (int)type;18
MessageBox.Show(intType.ToString());19
}


浙公网安备 33010602011771号