VB.NET - must implement 'foo' for interface 'bar'

Asked By Christopher Baker on 24-Aug-12 10:19 AM
Can anyone spot why VS2010 claims that Class 'IVP_WebServices' must implement 'Function Prover(ics As InquiredCustomerSample) As String' for interface 'IProver'.? I'm stumped. It all looks so simple to me.

Namespace IVP_WebServices


    <DataContract()>
    Public Class InquiredCustomerSample
        <DataMember()>
        Property CustomerNbr As String
        <DataMember()>
        Property BillToNbr As String
        <DataMember()>
        Property CustomerName As String
        <DataMember()>
        Property CustomerAddress01 As String
        <DataMember()>
        Property City As String
        <DataMember()>
        Property StateProvince As String
        <DataMember()>
        Property ZIP As String
    End Class


    Public Class CustomerToInquire
        Property RequestID As String
        Property RequestMode As String
        Property CMSDataBase As String
        Property ServLang As String
        Property ServPlntCod As String
        Property CustomerNbr As String
    End Class


    <ServiceContract()>
    Public Interface IProver
        <OperationContract()>
        Function Prover(ByVal ics As InquiredCustomerSample) As String
    End Interface


    Public Class IVP_WebServices
        Implements IProver


        Function Prover(ByVal ics As InquiredCustomerSample) As String
            Return String.Format("CustomerNbr: {0} CustomerName: {1}", ics.CustomerNbr, ics.CustomerName)
        End Function
    End Class




End Namespace

Robbe Morris replied to Christopher Baker on 24-Aug-12 10:57 AM
My VB.NET is really rusty.  The only thing I can "possibly" see is that your Prover method "appears" to be private.  I would think the interface would need the method to be public.
Christopher Baker replied to Robbe Morris on 24-Aug-12 11:42 AM
Thanks Robbe, but I already tried that, and Protected, and Shared, and Please, and PrettyPlease, and...
Robbe Morris replied to Christopher Baker on 24-Aug-12 12:10 PM
Again, my VB is really rusty.  Shouldn't the ByVal be ByRef when the parameter type is a custom class?

Aside from that, I just don't see anything else.  I've only written a small amount of code 8 years ago in VB.NET.  Sorry I can't be of more help.
Christopher Baker replied to Christopher Baker on 24-Aug-12 03:50 PM
Figured it out

  Public Class IVP_WebServices
        Implements IProver


        Function Prover(ByVal ics As InquiredCustomerSample) As String Implements IProver.Prover
            Return String.Format("CustomerNbr: {0} CustomerName: {1}", ics.CustomerNbr, ics.CustomerName)
        End Function
    End Class 

What a dumb-a$$ I am. Sometimes you can just stare and stare at something and not see what's right in front of your face.
Peter Bromberg replied to Christopher Baker on 25-Aug-12 06:46 PM
Interface methods are implicitly public so declaring them public is redundant. You cannot use access modifiers in an interface. The language is unimportant. It's the implementing class's responsibility to mark the accessibilty of the methods it implements.

I'd think that you probably want to declare your implemented Prover method as public.