PsychoCoder
Programmer
In my application I have written my own collection, the class starts like this:
Below that is my variable and property declarations then my New method then below that I have:
but in the Public Class.... line the word IComparable is underlined with the following error:
I have a CompareTo As Integer function in the class, the solution wont build because of this error. What am I doing wrong here?
Senior Qik III, ASP.Net, VB.Net ,SQL Programmer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Code:
Public Class Flight : Implements IComparable
Code:
Public Function CompareTo(ByVal obj As Object) As Integer
If Not (TypeOf obj Is Flight) Then
Throw New ArgumentException
End If
Dim f2 As Flight = CType(obj, Flight)
Dim cmpl As Integer = Me.FlightNumber.CompareTo(f2.FlightNumber)
If Not (cmpl = 0) Then
Return cmpl
End If
Return Me.SegNumber.CompareTo(f2.SegNumber)
End Function
but in the Public Class.... line the word IComparable is underlined with the following error:
Code:
Class 'Flight' must implement 'Function CompareTo(obj As Object) As Integer' for interface 'System.IComparable'.
I have a CompareTo As Integer function in the class, the solution wont build because of this error. What am I doing wrong here?
Senior Qik III, ASP.Net, VB.Net ,SQL Programmer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"In the new millennium there will be two kinds of business; those on the net and those out of business"
~ Bill Gates ~