I am using DevExpress 9.3 CheckedComboBoxEdit and I need to get a collection of all checked items. It seems like this should be a simple task, but the closest thing I found to solve is what I can use:
CheckedComboBoxEdit.Properties.GetItems.GetCheckedValues()
Unfortunately, there is no GetCheckedValues method here. I found the following:
CheckedComboBoxEdit.Properties.GetCheckedItems()
which returns an object, but I cannot find any reference to what I should use as an object. I also tried iterating over the elements and checking each one to see if it was checked by following the suggestion here , but Items returns a collection of strings, not CheckedListBoxItem, so I can't check if they are checked.
What I want is a String collection of checked items; right now, I can get them as a collection of any type, or even create a collection myself. I know that there must be some very simple thing that I am missing, but I cannot find it.
Decision
This is the solution I came across. I would prefer something more elegant; there seems to be a way to get tested items, as that is what control is needed for. However, this seems to work:
Private Function GetChecked() As List(Of String)
Dim checked As New List(Of String)
Dim checkedString As String = CType(SitePickerControl.Properties.GetCheckedItems(), String)
If (checkedString.Length > 0) Then
checked.AddRange(checkedString.Split(New Char() {","c}))
End If
Return checked
End Function
If someone can give me the right solution, I would love to see him.
source
share