[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

C# to VB.NET Syntax

Posted on 2004-10-26
4
Medium Priority
?
436 Views
Last Modified: 2010-08-05
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
0
Comment
Question by:F4Experts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Expert Comment

by:bramsquad
ID: 12415067
change

Implements

to

Inherits

~b
0
 

Author Comment

by:F4Experts
ID: 12415204
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
 
LVL 8

Expert Comment

by:bramsquad
ID: 12415336
where do you declare your interface?
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 400 total points
ID: 12415578
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

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question