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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top