System.Windows.Forms.BindingSource.Sort Property

Gets or sets the column names used for sorting, and the sort order for viewing the rows in the data source.

Syntax

[System.ComponentModel.DefaultValue(null)]
public string Sort { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

The BindingSource.Sort property is a case-sensitive string that specifies the column names used to sort the rows, along with the sort direction. Columns are sorted ascending by default. Multiple columns can be separated by commas, such as "State, ZipCode DESC".

To support sorting, the underlying list must implement the System.ComponentModel.IBindingList or System.ComponentModel.IBindingListView interfaces. This capability can be queried through the BindingSource.SupportsSorting property. Multicolumn sorting is available when the BindingSource.SupportsAdvancedSorting property is true.

Setting the BindingSource.Sort property will change the internal list depending on its type:

The internal list's sort properties are only changed when the sort string is not null. The get accessor for this property will not retrieve the sort value of the internal list; instead, it will return the set accessor value. The value of the BindingSource.Sort property will persist when the data source changes.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0