Mr Kuryakin Thanks for the answer this makes sense I did try before posting a compareto function in the plateobj class, which I have successfully used for sorting. Ok so how to use the code you posted. 1) I assume I add this to the plateobj class ? 2) I get an error that suggests instead of using Overides I should use Overloads 3) Dim plate As Plateobj = TryCast(obj, Plateobj)gives two errors - TryCast not declared - 'Plateobj' is a type and cannot be used as an expression. Could I ask you to insert your code into my example and post back. Many Thanks Geoff
Christian, Thanks a lot for your help, the mud becomes ever clearer. I was calling with as posted, I changed it as you suggested and it fires the method. Of course I now get a new error, but hey no one said it would be easy. Thanks again Geoff
Hey I solved my own question. The problem with my code was I was returning 1 for greater than an zero for <= . The compare function should return 1 for greater than 0 for equal to and -1 for less than. Phew on to the next stage. Public Class Posts Implements IComparable Public Name As String Public ID As Integer Public Selected As Boolean Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo Dim temp As Posts = CType(obj, Posts) Dim mestxt If Name > temp.Name Then Return 1 ElseIf Name = temp.Name Then Return 0 Else Return -1 End If End Function End Class
Thanks for the code it works. I am suffering from one problem, if I wait say 1 hour from shut down the Wake on lan does not work. This problem does not effect a wol utility I am using. Any Ideas Thanks Geoff