The ComboBox control in Windows Forms is a combination of a TextBox with a drop down list that presents preset choices. The user can type anything into the ComboBox, or select something from the list.

This C# article demonstrates the ComboBox control. It covers ComboBox properties and event handlers.
To begin, please create a new Windows Forms application and add a ComboBox to it. You can then right-click on the ComboBox and add the SelectedIndexChanged and TextChanged event handlers in the Properties dialog. This program demonstrates how when you change the text by typing in the ComboBox or by clicking on the list of Items, the event handlers are triggered. Please see the section on the Items property before running the program.
Program that demonstrates ComboBox event handlers [C#]
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int _selectedIndex;
string _text;
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
// Called when a new index is selected.
_selectedIndex = comboBox1.SelectedIndex;
Display();
}
private void comboBox1_TextChanged(object sender, EventArgs e)
{
// Called whenever text changes.
_text = comboBox1.Text;
Display();
}
void Display()
{
this.Text = string.Format("Text: {0}; SelectedIndex: {1}",
_text,
_selectedIndex);
}
}
}The Text property of the ComboBox functions much like the Text property of a TextBox. If you assign to the Text property, the current value in the ComboBox will change. You can also read the Text property and assign string variables to it, as demonstrated in the above event handlers. To clear it, you can assign it to an empty string literal "".
TextBox TutorialThe Items property contains the strings that are found in the drop-down part of the ComboBox. You can type the Items line-by-line into Visual Studio through the Items dialog, or you can dynamically add them during runtime or startup of your program. To add Items programmatically, call the Add method: use the syntax comboBox1.Add("Value"). You can also Clear the ComboBox by calling Clear().

Conceptually, the ComboBox is used to represent a text input with a set of associated, predefined values that are easy to select. For this reason, it is a good choice for preference dialogs. You can use ComboBox controls and have preset values that are present in the drop-downs, but allow your users to select any value by typing it in directly. This avoids the need for more than one control.
There are three properties for AutoComplete on the ComboBox: the AutoCompleteCustomSource, the AutoCompleteMode, and the AutoCompleteSource. The AutoCompleteMode property can be set to suggest, append, or both. The Source properties let you specify the set of strings that are used as suggestions. Currently, there are no detailed AutoComplete examples on this website.
There are three DropDown style properties you can use in Windows Forms. They are the DropDownHeight, the DropDownStyle, and the DropDownWidth. The DropDownHeight and DropDownWidth properties do not seem to affect the visual appearance on my computer, as Windows uses its default widgets. The DropDownList property gives you the ability to remove the drop-down entirely (with Simple), or make it so the text is not editable (with DropDownList).
The MaxDropDownItems property does not seem to have its intended effect in my testing. In a ComboBox with three items, setting a MaxDropDownItems of one did not reduce the number of items shown. It may be that the property only is effective for when the DropDownStyle property is set to a non-default value.

By combining the TextBox and a regular drop-down list, the ComboBox control represents a truly useful hybrid widget in Windows Forms. Ideal for dialogs where some suggestions for an input may be known, but any value must be accepted, the ComboBox can streamline your interface by coalescing multiple user interface controls.
Windows Forms