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.
DropDownStyle
A ComboBox has three different styles.
DropDown (default)
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.
Simple
The Simple
style is almost the same as the DropDown
, except the list is always displayed.
DropDownList
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.
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.