I downloaded the sorting code in chapter 2, and it worked fine. I then added the Sort module, Person file and part of the Form code to my project. The project ran just like your code, except mine would not calculate the ages, and the resulting sort left the array just like it was. I found out that if I substituted a typed in date like this #7/1/2015# for my variable date, it would then calculate the ages.
Is there some way to make your Sort code use dates and other information residing in variables? Here's the code I used.
Code:
' Get the last Id number in RLM42HD
Dim LastRow As Integer = 0
Dim LastId = From lId In db.RLM42HDs
Select lId.Id, lId.Date, lId.OrderNumber
For Each lId In LastId
LastRow += 1
Next
Dim myPeople(LastRow - 1) As Person
For Each lId In LastId
curId = lId.Id
curDate = lId.Date
myPeople(lId.Id - 1) = New Person(curId, curDate) '-1 to accom. the array No's
Next
'Although this sort procedure works, it doesn't sort properly. If I replace the varitable curDate with an actual date, it works.????????????
DoSort(myPeople, AddressOf Person.CompareAge)
BobE