Question about CheckedListBox and binding to the check box value.
I have set DisplayMember propert to “Name”. And that seems to work.
And then ValueMember to “GoodGuy”. GoodGuy is a bool. But that does not work. Suggestions?
See attached picture.
The purpose of ValueMember is to assign a value to each item in the list. When the user selects a list item, checkedListBox.ValueMember determines what checkedListBox.SelectedValue is. For example, if the DataSource objects have a property called ID, then SelectedValue can be used to get the ID of the currently selected value when checkedListBox.ValueMember = “ID”.
You can set the checkbox values to match bools in the DataSource using a for-loop and checkedListBox.SetItemChecked(int index, bool isChecked). The indices in the CheckedListBox match the ones in the DataSource.
for (int i = 0; i < dataList.Count; i++)
Hope this helps,