user3516240 user3516240 - 2 years ago 380 Question

DevExpress Add items to ComboBox at run time

I've recently started using the DevExpress Comboboxes and other UI components. But I'm struggling to add items to the ComboBoxes during rune-time. The default Visual Basics's ComboBox worked simply by using the

code... But DevExpresses seam much more complicated, I've spent the last hour trying to work out how to add an item to the Combobox during run-time. And now this is my final option.

Has anyone got an idea on how this could be done? To be a little clearer, I'm trying something like this:

If combobox1.SelectectItem = "Item1" Then
Combobox2.items.add("Added Item String")
end if

just using syntax the DevExpress classes will 'understand'.

Answer Source

All DevExpress editors have the SomeEditor.Properties property which contains settings specific to the editors. So, you can get Items collection from comboBox.Properties.Items property:

If combobox1.SelectectItem.ToString = "Item1" Then 
    Combobox2.Properties.Items.Add("Added Item String")
End If
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download