Sort

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hi, I have a sort question defined as below:
*environment: C#, ADO.NET, window application
*after a DataSet is filled.
*its table is rendered in some control, ie ListBox,DataGrid
*if I want change the sort order
*using the previous filled DataSet
Please advice. Thanks.
Peter
 
Instead of binding to a DataSet, you can bind to a DataView, which is simply
based on one of the tables in the view and then sort away....

Dim myDataView as New DataView(myDataSet.Tables(IndexOfTable))

Then you can bind myDataView to your given control and then change the sort
order by calling myDataView.Sort = "FieldYouWantToSortBy"

HTH,

Bill
 
Back
Top