comparing two sorted lists

afternoon all

I need to compare the 2 sorted lists. i am receiving data multiple times per second and storing it to a sorted list. I need to compare the incoming data frame to the previously received data frame and record only the changes.

Public Class processData
Public statusChanges As New SortedList
Public lastFrameList As New SortedList

Public Sub getData()
....receive data code
compareit(statusList)
End Sub

Public Sub compareit(ByVal statusList as SortedList)
statusChanges.Clear()
For listIndex = 0 To statusList.count -1

If statusList(listIndex) <> lastFrameList(listIndex) Then
statusChanges.Add(sataList.GetKey(listIndex),statusList,GetByIndex(listIndex)
End If

Next
lastFrameList = statusList 'save the newest frame to be compared in the next iteration
End Sub

End Class

I know i am not declaring lastFrameList correctly becuase it runs correctly the first time but when I receive the 2nd frame and try to compare, it wont return any changes because laststatusList already = the new statusList before the compareit routine is run the second time

Thanks for your help

[1549 byte] By [meriano] at [2008-1-7]