Marwan مروان
Marwan مروان

Reputation: 2221

Programmatically Checking DevExpress CheckedComboBoxEdit Items

I have a CheckedComboBoxEdit that's bound to a TableAdapter that populates it with a list of items.

I have a separate query that returns a dataset that lists the items that need to be checked.

I need to iterate through the CheckedComboBoxEdit items to check them as needed.

How can I make the CheckedComboBoxEdit reflect the data from the query which returns a list of items that need to be checked?

I'm using C# in Visual Studio 2010 with DevExpress 10.2.9.

Any help on this would be greatly appreciated, and any other solutions to this issue would be great too.

Upvotes: 4

Views: 10694

Answers (3)

Turker Tunali
Turker Tunali

Reputation: 397

Short code snippet.

string str = "first;second";
string[] array = str.Split(';');
char separator = checkedComboBoxEdit1.Properties.SeparatorChar;
string result = string.Empty; 
foreach (var element in array){
   result += element + separator;
}

checkedComboBoxEdit1.SetEditValue(result);

Upvotes: 1

antew
antew

Reputation: 979

Here is how to

checkedComboBoxEdit1.Properties.SeparatorChar = ';';
// Set the edit value, assuming you have items named "one",and "two"
checkedComboBoxEdit1.SetEditValue("one; two");

Here is the complete example

Upvotes: 2

Uranus
Uranus

Reputation: 1690

Items state of the CheckedComboBoxEdit tied to its EditValue. You can check items by setting an appropriate editor value: a list of values (each item has the value and display text) delimited with a separator sign. The separator sign is specified via the RepositoryItemCheckedComboBox.SeparatorChar property.

Upvotes: 2

Related Questions