VBUC Documentation | Mobilize.Net
Mobilize.NetForumsBlogDocumentation Home
  • Mobilize.Net VBUC
  • Introduction
  • Install and Licenses
  • Get Started
  • Migration Guide
  • VBUC Features
  • Mappings Grammar
  • Generated Code
  • Upgrade Options
    • Data Access
    • Grids
    • Microsoft
    • Sheridan
    • Others
    • Code Conversion
    • C# Features
  • Third-party controls
  • Best Practices
  • EWIs
    • Warnings
    • Issues
    • ToDos
    • Notes
  • Issues and Troubleshooting
    • Microsoft.VisualBasic Uses
    • Safe and Unsafe Methods Layer
    • Third Party Components
    • Migration Process
    • Classic ADO Conversion to ADO.NET
    • VB6 and .NET integer division
    • VB6 On Error Statements
    • Running a .NET Core application in a machine with no Visual Studio installed
    • Databases issues
    • Unsupported assemblies on .NET Core and .NET 5
    • Icon Extraction Issues
    • HTTPS sites are not loaded in Windows XP
    • Short-Circuit Boolean Logic in C#
    • Assessment Report Issue
  • Knowledge Base
    • FAQ
      • Does the VBUC support the Sheridan VB 6.0 controls suit?
      • How effective is the Visual Basic Upgrade Companion tool at converting an application's front end?
      • What controls does the Visual Basic Upgrade Companion tool supports?
      • How does the VBUC handle VB6 Collections?
      • Can the VBUC migrate intrinsic VB6 functions and libraries?
      • Where is the source code for the support (helper) classes used by the VBUC?
      • How does the VBUC convert ADO to ADO.NET?
      • Can the Visual Basic Upgrade Companion tool be customized?
      • What are Stubs?
    • How-To
      • App.Config and Database Access
      • Avoid reflection in Hot Paths
      • Convert ESRI ArcGIS Visual Basic 6.0 applications to .NET
      • Drag and Drop Conversion Steps
      • Inserting elements in a ListView
      • String vs StringBuilder
      • Word Automation in VB6 vs .NET
      • Configure default Factory Database provider
      • GetPrivateProfileString Windows API working in migrated code
      • Upgrade projects with shared files
  • Release Notes
Powered by GitBook
On this page

Was this helpful?

Mappings Grammar

In the following section, you will find a description and documentation of Mappings Grammar Tool.

PreviousVBUC FeaturesNextGenerated Code

Last updated 1 month ago

Was this helpful?

Mappings Grammar

Mapping is a crucial concept for our migrators. It means that from a set of values as input, a function is applied to each value, and generates a set with new values.

It's a powerful tool that allows design mappings by using a syntax quite similar to C#, which is used to transform VB6 code to its equivalent in .NET (C# or VB).

This applies to the following statements:

  • Types

  • Members (Methods, properties, subroutines, events, among others)

Also, this tool offers the possibility to generate code for statements that are not supported in .NET (for more information, see ), reducing the time to carry out the compilation of a migrated project.

In the code below they are some types like enumAlign and ctTips (ctTips1), including some members like Active, Tag, ToolTipText and Alignment.

Original VB6 Code source

Dim enumVal As enumAlign
...
Private Sub setCtTips()
    ctTips1.Active = True
    ctTips1.Tag = "Display component"
    ctTips1.ToolTipText = "CtTips1"
    ctTips1.Alignment = enumVal
End Sub

By using Mappings Grammar it is possible to migrate classes and their members to their .NET equivalent.

Mappings design using Mappings Grammar

type TipsLib.ctTips => System.Windows.Forms.ToolTip;
type TipsLib.enumAlign => nomap;

member TipsLib.ctTips.Active => Active as boolean;
member TipsLib.ctTips.Container => Container;
member TipsLib.ctTips.Tag => Tag as string;
member TipsLib.ctTips.ToolTipText => ToolTipTitle as string;
member TipsLib.ctTips.Alignment => nomap;

C# Code Generated by VBUC

//UPGRADE_ISSUE: (2068) TipsLib.enumAlign object was not upgraded.
UpgradeStubs.TipsLib_enumAlignEnum enumVal = (UpgradeStubs.TipsLib_enumAlignEnum) 0;
...
private void setCtTips()
{
    ctTips1.Active = true;
    ctTips1.Tag = "Display component";
    ctTips1.ToolTipTitle = "CtTips1";
    //UPGRADE_ISSUE: (2064) TipsLib.ctTips property ctTips1.Alignment was not upgraded.
    ctTips1.setAlignment(enumVal);
}
  • Notes:

    • As shown in the example above, ctTips will be upgraded into System.Windows.Forms.ToolTip.

    • Some members of ctTips class like Active, Container, Tag and ToolTipText will be upgrade to its .NET equivalent.

    • There are some classes and members that are not supported in .NET, so it generates stubs; like the class enumAlign and the member Alignment.

Upgrade Stubs
803KB
Mappings Grammar Documentation.pdf
pdf