Your IComparer only compares two of your object instances. In the code
for the Compare, you just need to specify whether one of them is
'greater' or 'less' than the other. When you implement the Compare
function, first compare the portfolio code and only compare the asset
code if the portfolio code is the same (watch for typos):
Public Function Compare(x As Object, y As Object) As Integer
Dim obj1, obj2 As TheClass
'Code here to verify that x and y are both instances of TheClass
obj1 = DirectCast(x, TheClass)
obj2 = DirectCast(y, TheClass)
If obj1.Portfolio < obj2.Portfolio Then
Return -1
Else
If obj2.Portfolio > obj1.Portfolio Then
Return 1
Else
If obj1.Asset < obj2.Asset Then
Return -1
Else
If obj2.Asset > obj1.Asset Then
Return 1
Else
Return 0
End If
End If
End If
End If
End Function
This is code off the top of my head so watch for typos.
Chris