在 CheckedComboBoxEdit 中获取选中的活动值

Get Checked active value in a CheckedComboBoxEdit

我想知道如何在 CheckedComboBoxEdit 中选中活动状态以将活动值保存在数据库中。 我有一个包含 N 个数据量的列表,我只想保存活动数据。

谢谢!!

嗨,你能试试这个吗

CheckedComboBoxEdit.Properties.GetItems.GetCheckedValues()

如果它适合你,请告诉我。

有关 CheckedComboBoxEdit 成员的更多信息: https://documentation.devexpress.com/#WindowsForms/DevExpressXtraEditorsCheckedComboBoxEditMembersTopicAll

You can get a collection of checked items using the CheckedComboBoxEdit.Properties.GetItems.GetCheckedValues() method. It just return the value of the checked items in the underlying list control.

要完成此任务,您还可以使用以下方法:

    string items = string.Empty;
    foreach (CheckedListBoxItem item in checkedComboBoxEdit1.Properties.GetItems())
        if (item.CheckState == CheckState.Checked)
            items += string.Format("{0} YES \r\n", item.Description);
        else
            items += string.Format("{0} NO \r\n", item.Description);
    items = items.TrimEnd("\r\n".ToCharArray());
    XtraMessageBox.Show(items);

更多参考资料:

Get Checked Items In A DevExpress CheckedComboBoxEdit
How to iterate through through CheckedComboBoxEdit
How to retrieve the checked items in the CheckedComboBoxEdit control