To undo a sort, use the DataView.Sort property to return the data to the default view. Add the following code, in this example the code was added to the Button1_Click event:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.CustomersBindingSource.Sort = "" |
To write code in C#
C# |
Copy Code
|
---|---|
this.CustomersBindingSource.Sort = ""; |
Here is the table sorted by the LastName column:
After clicking the Undo Sort button, the sort is undone.