111,098
社区成员




/// <summary>
/// 绑定列表到combobox控件
/// </summary>
void loadAccountlist ()
{
string Current = Directory.GetCurrentDirectory();
IniFileHelper ini = new IniFileHelper(Current + "/config.ini");
string dbname = ini.ReadValue("Datebase", "DBName");
AccountListService alc = new AccountListService();
List<AccountList> list = alc.GetAccountLists();
cbAccount.DataSource = list;
cbAccount.DisplayMember = "Describe";
cbAccount.ValueMember = "Alias";
if (!String.IsNullOrEmpty(dbname))
{
//如何实现遍历实现dbname是否存在ValueMember数组中
// for (int i = 0; i < cbAccount.Items.Count; i++)
//foreach (System.Reflection.PropertyInfo info in cbAccount.Items)
//{
// // if (dr==dbname)
cbAccount.SelectedValue = dbname;
//}
}
else {
ini.WriteValue("Datebase", "DBName", cbAccount.SelectedValue.ToString());
}
}