我正在使用.NET 2.0,并尝试将组合框的数据源绑定到排序字典。
所以我得到的错误是“在数据源上找不到DataMember属性'Key‘”。
SortedDictionary<string, int> userCache = UserCache.getSortedUserValueCache();
userListComboBox.DataSource = new BindingSource(userCache, "Key"); //This line is causing the error
userListComboBox.DisplayMember = "Key";
userListComboBox.ValueMember = "Value";发布于 2014-10-08 22:28:14
var colors = new Dictionary < string, string > ();
colors["10"] = "Red";绑定到组合框
comboBox1.DataSource = new BindingSource(colors, null);
comboBox1.DisplayMember = "Value";
comboBox1.ValueMember = "Key"; 完整源代码...Dictionary as a Combobox Datasource
Jeryy
https://stackoverflow.com/questions/6412739
复制相似问题