小编use*_*952的帖子

使用Dictionary作为数据源绑定组合框

我正在使用.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";
Run Code Online (Sandbox Code Playgroud)

.net c# combobox datasource winforms

59
推荐指数
4
解决办法
11万
查看次数

标签 统计

.net ×1

c# ×1

combobox ×1

datasource ×1

winforms ×1