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
  • Component One Classes Extensions
  • TrueDbGrid ActiveX Conversion

Was this helpful?

  1. Issues and Troubleshooting

Third Party Components

PreviousSafe and Unsafe Methods LayerNextMigration Process

Last updated 1 year ago

Was this helpful?

Component One Classes Extensions

VSPrinter Component

This Activex Component from ComponentOne doesn't have direct equivalent in the ComponentOne control collection for .NET. For that matter, extension classes are needed:

  • To avoid changing the logic in the migrated code.

  • Maintainability.

The ComponentOne documentation provides information on which components to use for printing and previewing. You can check here:

Textually, the ones that serve our purpose are:

  • "The C1PrintDocument component provides a rich object model which allows you to create arbitrarily complex documents in code."

  • "The integrated components (the C1PrintPreviewControl control and the C1PrintPreviewDialog dialog box) make adding a professional-looking preview to your applications a snap."

Extensions

The extensions classes were created with the required elements that need to be exposed in mind (properties, methods, events, etc.).

A deep investigation of both controls is needed to code equivalent behavior.

Testing is crucial to find and correct bugs.

Let's review the Action property. On the surface, it just assigns a value to the property:

Original VB6 code

m_objVSPrinter1.Action = paStartDoc

m_objVSPrinter1.Footer = ""
strTabs = "^" & CStr(m_objVSPrinter1.PageWidth) & "~"
m_objVSPrinter1.MarginLeft = 650 ' was 0 AA: FW 6542
m_objVSPrinter1.CurrentY = (m_objVSPrinter1.PageHeight / 2) - 1000
m_objVSPrinter1.FontSize = 14
m_objVSPrinter1.Table = strTabs & "NO RECORDS FOUND~~"

Upgraded C# code

m_objVSPrinter1.Action = UpgradeHelpers.Gui.C1PrintDocumentExtension.
ActionSettings.paStartDoc;

m_objVSPrinter1.Footer = "";
strTabs = "^" + m_objVSPrinter1.PageWidth.ToString() + "~";
m_objVSPrinter1.MarginLeft = 650; // was 0 AA: FW 6542
m_objVSPrinter1.CurrentY = Convert.ToInt32((m_objVSPrinter1.PageHeight / 2) - 1000);
m_objVSPrinter1.FontSize = 14;
m_objVSPrinter1.Table = strTabs + "NO RECORDS FOUND~~";

Looking at the documentation, it says the following regarding that property: "Action Property (VSPrinter) Executes an action such as 'StartDoc' or 'EndDoc'.".

Detailed information is given about what it does with each value. The code should work accordingly.

Constant

Value

Description

paNone

0

No effect.

...

...

...

paStartDoc

3

Equivalent to the StartDoc method.

...

...

...

paEndDoc

6

Equivalent to the EndDoc method.

...

...

...

Code snippet with the implementation

public ActionSettings Action
{
    get
    {
        return _action;
    }

    set
    {
        _action = value;
        ExecuteDocumentAction();
    }
}
private void ExecuteDocumentAction()
{
    switch (Action)
    {
        case ActionSettings.paStartDoc:
            IsDocumentEnded = false;
            _docStarted = true;
            InitializeDocument();
            break;
        case ActionSettings.paEndDoc:
            if (_docStarted)
            {
                EndDocument();
            }
            break;
            //...more code omitted
        default:
            break;
    }
}

TrueDbGrid ActiveX Conversion

Description

The VBUC allows converting the TrueDBGrid Actvex to .NET equivalents: C1 TrueDbGrid .NET version or to a Mobilize HelperClass extending the .NET DataGridView.

Component One (C1) TrueDBGrid (.NET version)

There are important differences between the Activex and the .NET controls.

TrueDbGrid Columns

For the Activex version, design properties can be accessed from the grid's Columns collection, but in the .NET version, design properties can only be accessed via the DisplayColumn collection of the grid's Splits collection.

In VB6, code like the following:

<truedbgrid_instance>.Columns(0).Alignment = dbgGeneral

This instruction affects the alignment of all displayed columns in the grid.

On the other hand, when using the C1 version of the TrueDBGrid, that visual property can only be accessed by indicating explicitly the Split containing the column.

The above VB6 column would be converted as follows:

//UPGRADE_WARNING: (2081) Getting a DataColumn not from a split has a new behavior.
<truedbgrid_instance>.Splits[0].DisplayColumns[this.tgd_Fam.Columns[0]].Style.HorizontalAlignment = C1.Win.C1TrueDBGrid.AlignHorzEnum.General;

However, this only affects the columns in Split[0].

.NET Component that extends the DataGridView

All instances of the TrueDBGrid are converted to an extension of the DataGridView. Design limitations of the .NET DataGridView affect the capabilities of the grid.

Getting a DataColumn not from a split has a new behavior

Description

This entry describes the different behavior observed in .NET applications when the TrueDbGrid Activex component is migrated to the C1 TrueDBGrid .NET version when column properties are accessed for getting/setting purposes.

This entry covers the UPGRADE_WARNING: (2081) Getting a DataColumn not from a split has a new behavior EWI.

TrueDBGrid Columns

For the Activex version, design properties can be accessed from the grid's Columns collection, but in the .NET version, design properties can only be accessed via the DisplayColumn collection of the grid's Splits collection.

In VB6, code like the following:

<truedbgrid_instance>.Columns(0).Alignment = dbgGeneral

This instruction affects the alignment of all displayed columns in the grid.

On the other hand, when using the C1 version of the TrueDBGrid, that visual property can only be accessed by indicating explicitly the Split containing the column.

The above VB6 column would be converted as follows:

//UPGRADE_WARNING: (2081) Getting a DataColumn not from a split has a new behavior.
<truedbgrid_instance>.Splits[0].DisplayColumns[this.tgd_Fam.Columns[0]].Style.HorizontalAlignment = C1.Win.C1TrueDBGrid.AlignHorzEnum.General;

However, the above line only affects the columns in Split[0].

If the source grid contains multiple Splits, then the code must be adapted to reflect that situation.

A possibility would be creating a for-each loop to iterate through all Splits in the grid.

foreach(C1.Win.C1TrueDBGrid.Split split in <truedbgrid_instance>.Splits)
{
   split.DisplayColumns[0].Style.HorizontalAlignment = C1.Win.C1TrueDBGrid.AlignHorzEnum.General;
}

This EWI in previous VBUC versions

Starting with the public version of the VBUC 8.2, a for-each loop was created for a limited set of mapped elements of this library, making the code hard to read for an inexperienced user, seeing a lot of new code that was not present in VB6 code. Therefore, starting on VBUC 8.2.50602 this was modified in mappings for this component.

Fortunately, the is well detailed. It is the primary source of information.

This conversion targets the Activex migration to their .NET equivalent of .

VSPrinter control documentation
ComponentOne
Reports for WinForms Overview
C1 Print Classes
ComponentOne TrueDBGrid Option