Skip to content

ComboBox Class

Represents a Windows combo box control

Usage

A ComboBox is a text box combined with a list box. A ComboBox allows a user to select items in a list or enter a new value. A ComboBox contains a collection of objects, defined by its Items property.

A ComboBox has three different styles.

The DropDown style allows a user to select an item from a list or enter a new value. The list is displayed when the user clicks the drop-down button. A common use for this style is a search input, where the list displays the search history.

ComboBox DropDown Style

Simple

The Simple style is almost the same as the DropDown, except the list is always displayed.

ComboBox Simple Style

The DropDownList style works like the DropDown style in the sense that the user has to click the drop-down button to expose the list, but the user cannot enter a new value.

ComboBox DropDownList Style

Notable Class Members

Inherits members from the Control Class.

Properties

  • DropDownStyle - Gets or sets a value specifying the style of the combo box.
  • Items - Gets an object representing the collection of the items contained in this ComboBox.
  • SelectedIndex - Gets or sets the index specifying the currently selected item.
  • SelectedItem - Gets or sets currently selected item in the ComboBox.
  • SelectedValue - Gets or sets the value of the member property specified by the ValueMember property.
  • Text - Gets or sets the text associated with this control.

Events

  • SelectedIndexChanged - Occurs when the SelectedIndex property has changed.
  • SelectedValueChanged - Occurs when the SelectedValue property changes.

Further Reading