How to Add Items from Comboboxes to Windows Forms

On a recent PoC (Proof-of-Concept) I had to add items from two comboboxes to a Windows Form combobox. Here is a simple solution to that:

1. Highlight the combobox control in Object Explorer and click the Explore Component Properties button at the top of the Object Explorer.

2. You should see the list of properties available for the combobox control. Select the "Items" property and then select Configure Type to see Properties and Methods of the combobox.

3. Select the Methods you would like to use and then click OK. The methods you selected will appear in the Object Explorer. I've added Items.AddRange(Object[] items) to add an Array of items Commonly used methods are:

4. Then on my Automation I just added the AddRange method to be populated by the combobox from a Windows Application. Something similar to the following:

I just did the same thing for the other combobox items I wanted to add to my Windows Form combobox and ended up with all of them in one single control.

Popular posts from this blog

How to Declare Variables in MS-SQL Server Management Studio

Calling Web Services with Apache Camel

Using HTTP-based endpoints with Apache Camel