Can I Order My Collection?

P

Patrick A

All,

If I want to build a collection in a specific order, and I'm filling
it from a TableAdapter whose source query I can not change, how would
I put it in the order of one of the columns in the underlying query?

I've tried various things as spelled out in my book and other sources,
but nothing seems to "recognize" a column name.

Here's what I have;

Me.QRY_ButtonsTableAdapter.ClearBeforeFill = True

Me.QRY_ButtonsTableAdapter.Fill(Me.L55TimerDataSet.QRY_Buttons)
Dim Row As Integer = 0
Dim ButRecds =
L55TimerDataSet.Tables("QRY_Buttons").AsEnumerable
Dim sortedButRecds = From a_row In ButRecds _
Select a_row _
Order By TimerPos Descending

Suggestions?

Thanks,

Patrick
 
P

Patrick A

Patrice,

Thanks for your reply.

It worked!

Me.QRY_ButtonsTableAdapter.ClearBeforeFill = True
Me.QRY_ButtonsTableAdapter.Fill(Me.L55TimerDataSet.QRY_Buttons)

Dim Row As Integer = 0
Dim ButRecds =
L55TimerDataSet.Tables("QRY_Buttons").AsEnumerable.OrderBy(Function(c)
c.Field(Of String)("butLabel"))
Dim sortedButRecds = From a_row In ButRecds _
Select a_row

*************

Patrick
 

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

Top