HeaderPane
Main
Hide
Share Link
Print

Selection and Text

The selected item of the combo box is returned and set by the SftBox.SelectedItem property, an item of the list (ItemClass). For a list filled from a data source, the SftBox.SelectedDataItem property returns and sets the row of the selected item, and the SftBox.SelectedValue property its value (see Data Binding). For the font lists, SelectedValue returns the selected font family, style or size (see Font Lists).

Events

EventOccurs when
SftBox.SelectedItemChangedThe selected item changes, under program control or by the user. While the dropdown is open, moving in the list doesn't change the selected item; the item the user chooses does.
SftBox.SelectionCommittedThe user chooses an item: with a click in the list, with Enter, or with the arrow keys while the dropdown is closed. The event occurs even if the item chosen was already selected.
SftBox.SelectedValueChangedThe value of the SftBox.SelectedValue property changes, because another item is selected or because the value of the selected item's row changes.
SftBox.EditTextChangedThe user changes the text of the edit field by typing, pasting or deleting.

Text

The SftBox.Text property returns and sets the text of the edit field. An item shows the text of its display column in the edit field, defined by the SftBox.DisplayColumn property (for a list filled from a data source, the SftBox.DisplayMember property can name the member instead). The SftBox.DisplayText method returns the text an item shows.

Setting the text selects the first item whose display text equals it, ignoring case, or no item if there is none. A DropDown or Simple combo box keeps a text that matches no item; a DropDownList combo box shows the selected item's text instead. When the user presses Enter or leaves the field, the typed text selects the item whose text equals it, or no item.

The text of the edit field is edited like that of a TextBox control: SftBox.ReadOnly, SftBox.MaxLength, SftBox.TextAlign, SftBox.SelectionStart, SftBox.SelectionLength, SftBox.SelectedText, and the SftBox.Select, SftBox.SelectAll, SftBox.Copy, SftBox.Cut, SftBox.Paste and SftBox.Undo methods. The SftBox.Placeholder property defines a text shown while the field is empty (see Appearance).

Besides searching the list (see Searching), the edit field can offer the text completion of Windows from file names, URLs, the history or a list of strings: SftBox.AutoCompleteMode, SftBox.AutoCompleteSource and SftBox.AutoCompleteCustomSource work like those of a TextBox control.