Hi All!
I am trying to sort an arraylist using .Sort() but am not sure what to put in the () for the field/column I want to sort on. Could use some help. Here is the portion of my code that creates the array from a SQL Query
I want to sort by the CustGroup field, but am not sure what to put in the () after the sort to do that.
I will then be binding the ArrayList to a Datagrid.
Thanks for any help.
I am trying to sort an arraylist using .Sort() but am not sure what to put in the () for the field/column I want to sort on. Could use some help. Here is the portion of my code that creates the array from a SQL Query
VB.NET:
Dim th As TktHoldList
Dim aTktHold As ArrayList = New ArrayList
For i = 0 To dt.Rows.Count - 1
th = New TktHoldList
th.CustGroup = (dt.Rows(i).Item(0)).ToString.Trim
th.CustNbr = (dt.Rows(i).Item(1)).ToString.Trim
th.CustName = (dt.Rows(i).Item(2)).ToString.Trim & ", " & (dt.Rows(i).Item(3)).ToString.Trim
th.Site = (dt.Rows(i).Item(4)).ToString.Trim
th.FillDD = (dt.Rows(i).Item(5)).ToString.Trim
th.OutDD = (dt.Rows(i).Item(6)).ToString.Trim
th.DelvInst1 = ""
th.DelvInst2 = ""
th.CaseStatus = (dt.Rows(i).Item(7)).ToString.Trim
Try
th.NxtDelv = (dt.Rows(i).Item(8)).ToShortDateString
Catch
th.NxtDelv = ""
End Try
th.CustTerms = (dt.Rows(i).Item(9)).ToString.Trim
th.CustStatus = (dt.Rows(i).Item(10)).ToString.Trim
Try
th.RunOut = (dt.Rows(i).Item(11)).ToShortDateString
Catch
th.RunOut = ""
End Try
custnbr = (dt.Rows(i).Item(1)).ToString.Trim
th.PastDueAmt = f.GetPastDueBalance(custnbr)
aTktHold.Add(th)
Next
End If
[B]aTktHold.Sort("[U]NOT SURE WHAT TO PUT HERE[/U]" )[/B]
Session("THold") = aTktHold
gvTicketHold.DataSource = aTktHold
I want to sort by the CustGroup field, but am not sure what to put in the () after the sort to do that.
I will then be binding the ArrayList to a Datagrid.
Thanks for any help.