VB to .NET

Renaming References of Implementing Members

This issue applies only for C# target language.

The problem appears when an implementing member from a class is referenced in or out of the class. Remember, the implementing member in Visual Basic 6 is formed <Interface>_<Member>, and the target upgrade must remove the <Interface> prefix in order to get a correct syntax. It causes references to these members to be renamed to this new name to get the same functionality.

Original VB6 code

AClass.cls
Implements AnInterface
Sub AnInterface_AMethod(ByVal anArg As String)
    ' Code
End Sub
Sub MyMethod()
    AnInterface_AMethod ""
End Sub

AModule.vb

Private Sub Foo()
    Dim c As New AClass
    c.AnInterface_AMethod ""
End Sub


VB6 AI Migrator resulting C#.NET code

AClass.cls

    internal class Class1
    : AnInterface
    {
        public void  AMethod(string anArg)
        {
            // Code
        }
        public void  MyMethod()
        {
            AMethod("");
        }
    }

AModule.vb

    private void  Foo()
    {
        Class1 c = new Class1();
        c.AMethod("");
    }

 

Talk To An Engineer