C# to VB.NET Syntax

I am trying to convert some C# code to VB.NET....

I think I am declaring these properly, but I have something off:

C#:

private class AnonymousClassGWListener : GWListener
      {
            public AnonymousClassGWListener(TestDEMO enclosingInstance)
            {
                  InitBlock(enclosingInstance);
            }
            private void  InitBlock(TestDEMO enclosingInstance)
            {
                  this.enclosingInstance = enclosingInstance;
            }
            private TestDEMO enclosingInstance;
            public TestDEMO Enclosing_Instance
            {
                  get
                  {
                        return enclosingInstance;
                  }
                  
            }
            public virtual void  eventHandler(GWEvent e)
            {
                  System.Console.Out.WriteLine("Gateway listener event occurred");
                  System.Console.Out.WriteLine("user could handle this");
            }
      }

VB.NET with problem MARKED - intellisesnse says - 'TESTPROJ.frmTest.AnonymousClassGWListener' must implement 'Overridable Sub eventHandler(e As GWEvent)' for interface 'GWListener'.

   Private Class AnonymousClassGWListener
MARKED        Implements GWListener
       
      Public Overridable Sub eventHandler(ByVal e As GWEvent)
            System.Console.Out.WriteLine("Gateway listener event occurred")
            System.Console.Out.WriteLine("user could handle this")
        End Sub
       
      Public Sub AnonymousClassGWListener(ByVal enclosingInstance As frmTest)
            InitBlock(enclosingInstance)
        End Sub

        Private Sub InitBlock(ByVal enclosingInstance As frmTest)
            Me.enclosingInstance = enclosingInstance
        End Sub

        Private enclosingInstance As frmTest
        Public Property Enclosing_Instance() As frmTest
            Get
                Return enclosingInstance
            End Get
            Set(ByVal Value As frmTest)

            End Set
        End Property
    End Class
F4ExpertsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bramsquadCommented:
change

Implements

to

Inherits

~b
0
F4ExpertsAuthor Commented:
Then I get 'Classes can inherit only from other classes'

VB
Implements I1
C# -- class C1:I1 Specifies that the class (C1) implements the interface I1.  

VB
Inherits C2
C#-- class C1:C2 Specifies that the class (C1) inherits class C2.

VB
Implements I1
Inherits C2
C#-- class C1:C2,I1 Specifies that the class (C1) implements the interface I1 and inherits class C2.
0
bramsquadCommented:
where do you declare your interface?
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
You have to mark the sub that satisfies the interface requirements with the Implements keyword and the requirement you are actually satisfying like this:

    Public Overridable Sub eventHandler(ByVal e As GWEvent) Implements GWListener.eventHandler

        ' ...code...

    End Sub

~IM
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.