HMI Screen Development
- Luke Cerwin
This document describes the procedures and utilities for building real time Web based graphic screens under Visual Basic .NET 2003. These screens may be animated using real time data from a control system. Screens may be displayed on any workstation using a browser such as Microsoft Internet Explorer 5.5.
Upgrade TPRI VB6 Screens to VB.NET
Click Start
Select Programs
Select Microsoft Visual Studio .NET 2003
Click Microsoft Visual Studio .NET 2003 to start .NET 2003 development environment
Microsoft Upgrade Tools will handle about 80% of the conversion (depending on the project). But unfortunately the rest of the work has to be done manually.
Before attempting upgrade, make sure the vb6 project can be opened on your system. This will ensure you have the correct controls installed and the module paths correct.
Within .NET 2003 development environment click Open Project button
Select a VB6 project (vbp file)
Welcome to Visual Basic Upgrade Wizard window will open, Click Next
Choose a project Type: ensure that “DLL/custom control library” is selected, Click Next
Select the new VB.NET project directory name and location
Folder does not exist, create it? Click Yes, then click Next to begin
If you receive an Upgrade Failed error, it is because referenced modules from the VB6 project cannot be found in the specified location. Copy the modules folder to the correct location and repeat from step 2
Any controls in the original VB6 project that are not Microsoft standard controls will not be converted to the corresponding new .NET assemblies (The upgrade tools have no way of knowing there is any new .NET assembly for a given COM component). Instead the upgrade tools will treat the control just as there is no corresponding .NET assembly. It will create the interop/Ax* wrappers for the control (COM). Since all the TPRI standard controls are converted to .NET there is no need to keep any of the interop/Ax files around anymore.
Most of the common modules are included in the TPRI.BaseControl or TPRI.BaseScreen. But there are situations that some of the screens have their own special module(s). In that case the module(s) should remain in the project.
The .NET version of IobjSafe is implemented in the section: Signing of TPRI Screens.
The option of using Namespace to group the assemblies will also change the way we name the solutions, projects and classes.
In windows explorer, browse to newly created project directory
Delete the directory _UpgradeReport_Files
Delete the files:
_UpgradeReport.htm
ErrRpt.vb
IobjSafe.vb
Modules.vb
Any Interop/Ax*.dll file
Any Interop/Ax*.vb fileBack in the solution explorer of the .NET design environment:
Change the file names accordingly:
solution name
project name
.vb nameDelete the files:
_UpgradeReport.htm
ErrRpt.vb
IobjSafe.vb
Modules.vb
Any Interop/Ax*.dll file
Any Interop/Ax*.vb fileSave all files
For the same reason stated above there is no need to keep any of the interop/Ax or IObjectSafety reference anymore. It is also important to remove any COM object reference. Replace the COM components with the corresponding .NET assemblies.
Expand the References folder
The interop files are shown as just tpri*. You can show their full names by selecting them and looking at the properties for that file.
2. Replace any reference to Interop/Axtpri* with corresponding tpri .NET control
Easiest way is to add all references first:
Right-click References, select Add Reference
Browse to the Bin directory which contains the tpri control dlls and select the corresponding TPRI.* file
Continue to browse to add the rest of the tpri controls
Be sure to add the TPRI.BaseScreen and TPRI.BaseControl references
3. If you receive an error concerning changing where the array references are found, click OK
4. Remove the references:
IObjectSafetyTLB
VBRUN
Std*
MSDATASRC
Any AxucxxxxxArray
5. Add any other necessary .NET reference
TPRI.xxxx
TPRI.shape is needed when TPRI.ActiveShape is used
Gigasoft.ProEssentials.dll
C1.win.c1flexgrid.dll
C1.Common.dll
…
'Statement Option Explicit On' forces explicit declaration of all the variables in the module. (The default: Option Explicit On)
VB6 is not a type-safe language. VB.Net is type-safe (like C). 'Statement Option Strict On' enforces strict type checking. (The default: Option Strict Off)
View Code of ProjectName.vb
At the top, set the Options:
Option Explicit On
Option Strict OnOn the following line, Remove the control class attribute: <System.Runtime.InteropServices.ProgId("ucxxxx_NET.ucxxxx")>
Change the Public Class name to match the project name
© 2022 TelePro, Inc.
3811 Illinois Avenue, Suite 100, St. Charles, IL 60174