Third Party Components
Last updated
Last updated
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: 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."
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
Upgraded C# code
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
The VBUC allows converting the TrueDBGrid Actvex to .NET equivalents: C1 TrueDbGrid .NET version or to a Mobilize HelperClass extending the .NET DataGridView.
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:
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:
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.
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:
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:
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.
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.