# Adding Items to C1ComboBox

Learn how to add items easily to C1ComboBox through code.

## Content

You can easily add items to C1ComboBox programmatically using the **Add** method or you can add them at design time through the **String Collection Editor**. If you have more than one item, the **Add** method will add the new item(s) in the next position. If you need to add an item or object at a specific position in the list you can use the **Insert** method. An entire array can be added to the ComboBox by using the **AddRange** method to add the object or string of items to the C1ComboBox.

**To Add Items Programmatically**

To add items to the C1ComboBox using the Add method of the C1ComboBox class. The collection is referenced using the Items property.

DOC-DETAILS-TAG-OPEN
DOC-SUMMARY-TAG-OPEN
To write code in Visual Basic
DOC-SUMMARY-TAG-CLOSE

```vbnet
c1ComboBox1.Items.Add("Pittsburgh")
```

DOC-DETAILS-TAG-CLOSE
DOC-DETAILS-TAG-OPEN
DOC-SUMMARY-TAG-OPEN
To write code in C#
DOC-SUMMARY-TAG-CLOSE

```csharp
c1ComboBox1.Items.Add("Pittsburgh");
```

DOC-DETAILS-TAG-CLOSE

**To Add Items Using the String Collection Editor**

1. On the form, right-click on the **C1ComboBox** control and select **Edit Items**. The **String Collection Editor** appears.
2. In the **String Collection Editor**, enter the string and then press **Enter** to add the next string in position.

**To Insert the String or Object at the Desired Position**

The following example inserts the string, Chicago, in the fifth position:

DOC-DETAILS-TAG-OPEN
DOC-SUMMARY-TAG-OPEN
To write code in Visual Basic
DOC-SUMMARY-TAG-CLOSE

```vbnet
c1ComboBox1.Items.Insert(4, "Chicago")
```

DOC-DETAILS-TAG-CLOSE
DOC-DETAILS-TAG-OPEN
DOC-SUMMARY-TAG-OPEN
To write code in C#
DOC-SUMMARY-TAG-CLOSE

```csharp
c1ComboBox1.Items.Insert(4, "Chicago");
```

DOC-DETAILS-TAG-CLOSE

**To Pass an Array through Strings**

To pass an array through strings, complete the following:

1. Add the **C1ComboBox** control to the Form.
2. Add a **Button** control to the Form.
3. Create the following **Button\_Click** event handler and add the following code to pass the array through strings to the C1ComboBox:

DOC-DETAILS-TAG-OPEN
DOC-SUMMARY-TAG-OPEN
To write code in Visual Basic
DOC-SUMMARY-TAG-CLOSE

```vbnet
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
                               Dim items As String() = {"FreeStyle Stroke", "Back Stroke", "ButterFly Stroke", "Breast Stroke"}
                                C1ComboBox1.Items.AddRange(items)
            End Sub
```

DOC-DETAILS-TAG-CLOSE
DOC-DETAILS-TAG-OPEN
DOC-SUMMARY-TAG-OPEN
C#
DOC-SUMMARY-TAG-CLOSE

```csharp
private void button1_Click(object sender, EventArgs e)
     {
        string[] items = { "FreeStyle Stroke", "Back Stroke", "ButterFly Stroke", "Breast Stroke"};
        c1ComboBox1.Items.AddRange(items);
     }
```

DOC-DETAILS-TAG-CLOSE

4. Run your project and click on the **Button**.
5. Click on the dropdown button on the C1ComboBox control and notice the string of items appear in the dropdownlist:
    ![combobox](https://cdn.mescius.io/document-site-files/images/6c2f30e9-4d3a-4f86-b649-ecbef777b3a3/images/combobox_items.png)

## See Also

[Removing Items from C1ComboBox](/componentone/docs/win/online-input/usingthec1inputcontr/c1inputcontrols/C1ComboBoxControlOverview/ComboRemovingItems)