0
使用一个单独的枚举类我有这样如何在我的形式
public void SetOperationDropDown()
{
int ? cbSelectedValue = null;
if(cmbOperations.Items.Count == 0)
{
//ByDefault the selected text in the cmbOperations will be -SELECT OPERATIONS-.
cmbOperations.SelectedItem = "-SELECT OPERATIONS-";
//This is for adding four operations with value in operation dropdown
cmbOperations.Items.Insert(0, "PrimaryKeyTables");
cmbOperations.Items.Insert(1, "NonPrimaryKeyTables");
cmbOperations.Items.Insert(2, "ForeignKeyTables");
cmbOperations.Items.Insert(3, "NonForeignKeyTables");
cmbOperations.Items.Insert(4, "UPPERCASEDTables");
cmbOperations.Items.Insert(5, "lowercasedtables");
}
else
{
if(!string.IsNullOrEmpty("cmbOperations.SelectedValue"))
cbSelectedValue = Convert.ToInt32(cmbOperations.SelectedValue);
}
//Load the combo box cmbOperations again
if(cbSelectedValue != null)
cmbOperations.SelectedValue = cbSelectedValue.ToString();
}
但我需要做的,如果我想在一个单独的枚举类来定义这个函数,然后调用什么功能。
你想要做什么??? – 2010-11-30 07:40:07