Hello All,

I just wrote some code in C# and tried converting to VB.Net.
I am getting 3 kinds of errors in my code :-

  1. Class 'XXX' must implement 'Function XXX(abc,pqr,...)' for interface 'XX.XX.XX'.
  2. 'RaiseEvent' definition missing for event 'XXX'.
  3. 'XXX(abc,pqr,...)' is an event and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.

For first point, I am bit confused as I have already implemented all the Interface members into my class and even though the compiler is telling me that I must implement the same.
For example :-

Public Class MyConverter
    Implements IValueConverter
    Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object
        If value IsNot Nothing AndAlso TypeOf value Is Message Then
            Return True
        End If
        Return False
    End Function

    Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object
        Return Nothing
    End Function
End Class

shows the following error :-

Class 'MyConverter' must implement 'Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object' for interface 'System.Windows.Data.IValueConverter'.

Please help me with this.
Thanks to all.

aatish2327 commented: good question +0

Have you declared:

Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object

on your IValueConverter Interface class?. Did you Type manualy the:

Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object
        Return Nothing
    End Function

if so, delete it then point the typing cursor " |" to the end of

Implements IValueConverter

then press Enter to Automatically generate the Function ConvertBack code block for you. Hope you got it and solve your problem

Hey it solved my problem man...I did not think of deleting the code and letting the VS IDE generate for me but I wonder why it causes such problems even though I had the similar implementaion.
Anyways thanks a lot and if you have aqnswer to this one also please let me know...Appreciate ur help...thanks a ton :)

commented: good question +0

Try to compare what typed and what the VS code generated, it has Implements InterfaceName.FunctionName on the code generated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.