From: Patrick A on
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
From: Patrice on
Hello,

> Dim ButRecds =
> L55TimerDataSet.Tables("QRY_Buttons").AsEnumerable
> Dim sortedButRecds = From a_row In ButRecds _
> Select a_row _
> Order By TimerPos Descending

Try the doc at :
http://msdn.microsoft.com/en-us/library/bb386910.aspx (the compiler needs
some info about your columns).

Another option could be to define the sort order of the DefaultView :
http://msdn.microsoft.com/en-us/library/system.data.dataview.sort.aspx

--
Patrice



From: Patrick A on
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