Edita

Comparteix a través de


ComboBox.Sorted Property

Definition

Gets or sets a value indicating whether the items in the combo box are sorted.

public:
 property bool Sorted { bool get(); void set(bool value); };
public bool Sorted { get; set; }
member this.Sorted : bool with get, set
Public Property Sorted As Boolean

Property Value

true if the combo box is sorted; otherwise, false. The default is false.

Exceptions

An attempt was made to sort a ComboBox that is attached to a data source.

Remarks

This property specifies whether the ComboBox sorts existing entries and add new entries to the appropriate sorted position in the list. You can use this property to automatically sort items in a ComboBox. As items are added to a sorted ComboBox, the items are moved to the appropriate location in the sorted list. When you set the property to false, new items are added to the end of the existing list. The sort is case-insensitive and in alphabetically ascending order.

Attempting to set the Sorted property on a data-bound control raises an ArgumentException. You must sort the data using the underlying data model.

Applies to