The following code snippet illustrates the process:
Dim objDv as New DataView(objDataSet.Tables(0))
objDv.Sort = "Column1"
This code creates a DataView object using the first table in the DataSet and sorts the view on the column named Column1. To sort on multiple columns, use a comma-delimited list, like so:
objDv.Sort = "Column1, Column3"
If the un-sorted DataSet is bound to a control, such as a DataGrid, you'll need to bind the DataView to that object in order to see the newly sorted data. You can use code similar to the following:
DataGrid1.DataSource = objDv
DataGrid1.Bind()
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.