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