Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting
Message
 
To
20/05/2002 11:31:31
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00658912
Message ID:
00658929
Views:
18
Hi Randy,

Setting a sort/order does not change the *index* (record number) of the Table. As you are iterating from 0 - N you are adding the records sequentially without the sort order.

Try "For Each MyRow in MyTable.Rows" instead of "For i = 0 To Count -1"

Just a thought,
Kamal

>can anyone tell me why this code does not load my list box with data sorted by the field intSequence?
>
>
>' Added code for sorting the data
>      Me.gdsDataSet.Tables("RouteStops").Select(Nothing, _
>                  "intSequence ASC", DataViewRowState.CurrentRows)
>' End code for sorting
>
>Me.lstRouteSegments.Columns.Add("Sequence", 80, HorizontalAlignment.Left)
>Me.lstRouteSegments.Columns.Add("Location", 300, HorizontalAlignment.Left)
>Me.lstRouteSegments.Columns.Add("ID", 80, HorizontalAlignment.Left)
>
>For liCount = 0 To Me.gdsDataSet.Tables("RouteStops").Rows.Count - 1
>
>    Me.gdrRow = Me.gdsDataSet.Tables("RouteStops").Rows.Item(liCount)
>    lcListViewString = Me.gdrRow("strLocationDescription").ToString
>    liListViewIndex = Me.gdrRow(lstrIDName).ToString
>    liIntSequence = Me.gdrRow("intSequence").ToString
>
>
>    ' Set the view to show details.
>    Me.lstRouteSegments.View = View.Details
>    ' Select the item and subitems when selection is made.
>    Me.lstRouteSegments.FullRowSelect = True
>    ' Display grid lines.
>    Me.lstRouteSegments.GridLines = True
>    Me.lstRouteSegments.AutoArrange = False
>
>    ' Create the items.
>    Dim item1 As New ListViewItem(liIntSequence, 0)
>    item1.SubItems.Add(lcListViewString)
>    item1.SubItems.Add(liListViewIndex)
>
>    'Add the items to the ListView.
>    Me.lstRouteSegments.Items.AddRange(New ListViewItem() {item1})
>Next
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform