Links

Third Party Components

Component One Classes Extensions

The Compendia projects consume ComponentOne's VSPrinter component.
There is no direct equivalent in the ComponentOne control collection for .NET.
For that matter, extension classes were created:
  • 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: Reports for WinForms Overview
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."
C1 Print Classes

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.
Fortunately, the VSPrinter control documentation is well detailed. It is the primary source of information.
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.
ComponentOne TrueDBGrid Option

Component One (C1) TrueDBGrid (.NET version)

This conversion targets the Activex migration to their .NET equivalent of ComponentOne.
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.