Compile error help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Flomo Togba Kwele

    Compile error help

    I wrote the following class:

    Public Class CassPrintCompar er2
    Implements IComparer(Of ICASSPrint)

    Private _sortDescending As Boolean = False

    'pass true to the constructor to sort descending
    Public Sub New(ByVal descending As Boolean)

    _sortDescending = descending

    End Sub

    Public Function Compare(ByVal x As MailHouse2.Data Access.ICASSPri nt, ByVal y
    As MailHouse2.Data Access.ICASSPri nt) As Integer

    If (_sortDescendin g) Then
    Return y.SerialNo.Comp areTo(x.SerialN o)
    Else
    Return x.SerialNo.Comp areTo(y.SerialN o)
    End If

    End Function

    End Class

    I get the following syntax error which I cannot figure out:

    Error - Class 'CassPrintCompa rer2' must implement 'Function Compare(x As
    MailHouse2.Data Access.ICASSPri nt, y As MailHouse2.Data Access.ICASSPri nt) As
    Integer' for interface 'System.Collect ions.Generic.IC omparer(Of ICASSPrint)'.

    I just cannot see what I've done wrong. The IDE puts the squiggly error line
    under IComparer(Of ICASSPrint).

    Thanks, Flomo
  • =?Utf-8?B?S2VycnkgTW9vcm1hbg==?=

    #2
    RE: Compile error help

    Flomo,

    I think the syntax is:

    Public Function Compare(ByVal x As MailHouse2.Data Access.ICASSPri nt, ByVal y
    As MailHouse2.Data Access.ICASSPri nt) As Integer Implements IComparer(Of
    ICASSPrint).Com pare

    Kerry Moorman


    "Flomo Togba Kwele" wrote:
    I wrote the following class:
    >
    Public Class CassPrintCompar er2
    Implements IComparer(Of ICASSPrint)
    >
    Private _sortDescending As Boolean = False
    >
    'pass true to the constructor to sort descending
    Public Sub New(ByVal descending As Boolean)
    >
    _sortDescending = descending
    >
    End Sub
    >
    Public Function Compare(ByVal x As MailHouse2.Data Access.ICASSPri nt, ByVal y
    As MailHouse2.Data Access.ICASSPri nt) As Integer
    >
    If (_sortDescendin g) Then
    Return y.SerialNo.Comp areTo(x.SerialN o)
    Else
    Return x.SerialNo.Comp areTo(y.SerialN o)
    End If
    >
    End Function
    >
    End Class
    >
    I get the following syntax error which I cannot figure out:
    >
    Error - Class 'CassPrintCompa rer2' must implement 'Function Compare(x As
    MailHouse2.Data Access.ICASSPri nt, y As MailHouse2.Data Access.ICASSPri nt) As
    Integer' for interface 'System.Collect ions.Generic.IC omparer(Of ICASSPrint)'.
    >
    I just cannot see what I've done wrong. The IDE puts the squiggly error line
    under IComparer(Of ICASSPrint).
    >
    Thanks, Flomo
    >

    Comment

    • Flomo Togba Kwele

      #3
      RE: Compile error help

      Thanks, Kerry, I'm still a beginner.

      Comment

      Working...