VB to .NET

TODO #1067

Member 2% is not defined in type 3%.

Description

This EWI appears when an object cannot be typed correctly or a particular method could not be found in the class. This usually occurs for in late binding scenarios.

Recommendations

Register any required references by modifying the Upgrade Profile. The Profile Manager in Version 2.2 of the VB6 AI Migrator includes a helpful Reference Found column that highlights references of components found in the target VB6 project, which can optionally be mapped to .NET equivalents:

  • Reference Found
  • Enabling all relevant mappings should alleviate this EWI in most cases.

In some cases the VB6 AI Migrator will still be unable to map the reference correctly due to late binding scenarios where multiple types are sent as parameters.

Sample VB6

PublicSub CreateInstanceExample()

Dim PluginObj

PluginObj = GetObjectContext().CreateInstance("PluginNamespace.Plugin")

PluginObj.Func("A")

PluginObj.Action(1)

EndSub

Target VB.NET

PublicSub CreateInstanceExample()

Dim PluginObj AsObject = GetObjectContext().CreateInstance("PluginNamespace.Plugin")

'UPGRADE_TODO: (1067) Member Func is not defined in type Variant.

PluginObj.Func("A")

'UPGRADE_TODO: (1067) Member Action is not defined in type Variant.

PluginObj.Action(1)

EndSub

Expected VB.NET

Replace with a strongly typed equivalent in the migrated solution, which should now contain references to the required assemblies or DLLs.

PublicSub CreateInstanceExample()

Dim PluginObj AsObject = New PluginNamespace.Plugin

PluginObj.Func("A")

PluginObj.Action(1)

EndSub

Target C#

publicvoid CreateInstanceExample()

{

object PluginObj = GetObjectContext().CreateInstance("PluginNamespace.Plugin");

//UPGRADE_TODO: (1067) Member Func is not defined in type Variant.

PluginObj.Func("A");

//UPGRADE_TODO: (1067) Member Action is not defined in type Variant.

PluginObj.Action(1);

}

Expected C#

Replace with a strongly typed equivalent in the migrated solution, which should now contain references to the required assemblies or DLLs.

publicvoid CreateInstanceExample()

{

PluginNamespace.Plugin PluginObj = new PluginNamespace.Plugin();

PluginObj.Func("A");

PluginObj.Action(1);

}

Talk To An Engineer