0
我有列表存儲數據庫名稱和連接字符串用逗號分隔。我想將數據庫名稱設置爲顯示成員和連接字符串作爲值成員到組合框。如何通過拆分字符串設置組合框的顯示成員和值成員
Private void BindDataCombobox(){
List<string> conString =new List<string>();
conString.Add("Database1,'server=server1'");
conString.Add("Database2,'server=server2'");
conString.Add("Database3,'server=server3'");
conString.Add("Database4,'server=server4'");
combobox1.Datasource=conString;
combobox1.DisplayMember="I want to set this to hold Database1,Database2,...etc values";
combobox1.ValueMember="I want this to hold server1,server2,server3....etc";
}
謝謝你,它是有益的 – Tan