我有這樣的:的WinForms COMBOX - 添加項數據綁定列表,然後設置,是將selectedItem
cmbConnections.DisplayMember = "Name";
cmbConnections.ValueMember = "Index";
cmbConnections.DataSource = DBConnectionSettings.ConnectionList;
一切OK!
現在添加新項列表:
DBConnectionSettings.Connection c = new DBConnectionSettings.Connection();
c.Name = reply;
c.Index = DBConnectionSettings.ConnectionList.Count + 1;
DBConnectionSettings.ConnectionList.Add(c);
我現在想在comboxbox作爲選擇的項目,以顯示這個新項目。設置組合框的文本失敗。
感謝
你爲什麼要做Count + 1,我認爲Count至少有1個基數,所以如果有的話就是Count -1。 – 2009-07-21 14:32:50