How to Sort DataGridView data?
|
Article Information
|
Article relates to VIBlend DataGridView for WinForms
|
How To
|
Sort DataGrid’s data.
|
Solution
|
To achieve this, follow these steps:
|
1. Create a new instance of the vDataGridView via drag and drop from the toolbox or create it programmatically.
|
2. Bind the data grid to the Northwind's Invoices table( NWind.mdb is shipped with the product's installation) and set the SortMode property of the BoundFields.
|
|
3. After you bind the data grid, call the SortBy method in order to sort the DataGrid's data. The SortBy method can be found in the ColumnsHierarchy and RowsHierarchy classes. Therefore you can apply sorting either by rows or by columns. The following code code snippet sorts the data grid’s RowsHierarchy in ascending sort order.
|
|
|