The Combo control lets you perform some basic operations such as adding items, removing items, and much more. Please note that you need to set the value of DataMode property of the C1Combo class to add list items to Combo.
Lets explore how you can perform these operations on combo list items.
You can add items to the list using AddItem method of the C1Combo class. The AddItem method allows you to populate individual rows within the list. Please note that the default AddItem separator is semicolon ";". However, you can choose a custom separator by setting AddItemSeparator property of the C1Combo class.
Use the following code snippet to add rows to the Combo control.
C# |
Copy Code
|
---|---|
c1Combo1.AddItem("Smith; Elm St.;5887552"); c1Combo1.AddItem("John; Oak St.;6336958"); c1Combo1.AddItem("Aron; Silver Canoe Way;5869658"); |
You can use InsertItem method of the C1Combo class to insert an item at the specified position. The following code demonstrates how to insert the second row in the combo box list.
C# |
Copy Code
|
---|---|
c1Combo1.InsertItem("Joseph; Loch Ness Road ;7856247", 1);
|
The RemoveItem method allows you to remove rows by specifying the index of the row that you want to delete. The following code demonstrates how to remove the selected row from the Combo control:
C# |
Copy Code
|
---|---|
c1Combo1.RemoveItem(this.c1Combo1.SelectedIndex);
|
The ClearItems method removes all items from the list population. The following code removes the entire population from the combo box list.
C# |
Copy Code
|
---|---|
c1Combo1.ClearItems(); |