小编Xti*_*n11的帖子

Set checked items in checkedlistbox from list or dataset

I have a CheckedListBox and I would like to check all the items that are in another List. This code does not work since the CheckedItems property is read-only and the types do not match, but it gives the best idea of what I want to do.

    checkedListBox1.DataSource = DataSetSelectAll().Tables[0];
    checkedListBox1.ValueMember = "id_table";
    checkedListBox1.DisplayMember = "name";

    List<tableClass> list = MyCheckedList();
    checkedListBox1.CheckedItems = list;
Run Code Online (Sandbox Code Playgroud)

I know this is wrong but do not know how to explain it better.

c# dataset checkedlistbox winforms checklistbox

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

c# ×1

checkedlistbox ×1

checklistbox ×1

dataset ×1

winforms ×1