How to Sort a 2 dimensional table

Results 1 to 2 of 2

Thread: How to Sort a 2 dimensional table

  1. #1
    Join Date
    Dec 1969

    Default How to Sort a 2 dimensional table

    I would like to know if anyone knows how to sort a table with more than one dimension thank you !!<BR><BR>I use Array.Sort(name of my table); "That is for a single dimensional table only"<BR><BR>but what about a 2 or more dimensial table how can i sort it !!<BR><BR>Thanx !!

  2. #2
    Join Date
    Dec 1969

    Default RE: How to Sort a 2 dimensional table

    If you have the data in a DataTable (or in a DataSet) you can create a DataView from the DataTable&#039;s DefaultView. The DataView class has a Sort property which you can specify how to sort the data.<BR><BR>For example, if you had data with four columns, A, B, C, and D, and you wanted to get a "view" of the data sorted by column B in ascending order, with ties being broken by sorting on column D in descending order, you could do the following:<BR><BR>Dim myDataView as DataView = myDataTable.DefaultView<BR>myDataView.Sort = "B ASC, D DESC"<BR><BR>For more on getting a DataView from a DataSet, see my latest article:<BR><BR><BR>hth

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts