Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00658912
Message ID:
00658941
Views:
18
>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
>
The Table.Select method returns a DataRow array. Try changing your code to:

Dim foundRows As DataRow() = Me.gdsDataSet.Tables("RouteStops").Select(Nothing, _
"intSequence ASC", DataViewRowState.CurrentRows)

Then use the foundRows array to fill your list box.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform