Others

This section provides different options to upgrade other controls that are common in VB6 applications and that don’t fit in any of the other sections.

As with the previous options, all these components have two alternatives when upgrading them to .NET, one is to upgrade using COM Interop and the second one is to use .NET components.

1. Accusoft

1.1. To Accusoft .NET Version

General Description:

This solution converts the Accusoft VB6 library to the Accusoft.NET component.

Class

Maps to

AccusoftISISXpress7.ISISXpress

Accusoft.ISISXpressSdk.IsisXpress

AccusoftISISXpress7.ISX_SaveFileType

Accusoft.ISISXpressSdk.FileTypeInfo

AccusoftISISXpress7.ISX_ScanSetting

Accusoft.ISISXpressSdk.ScanSettingInfo

AccusoftISISXpress7.ISX_SetupOptions

Accusoft.ISISXpressSdk.SetupOptions

AccusoftImagXpress13.ImagXpress

Accusoft.ImagXpressSdk.ImageXView

AccusoftImagXpress13.enumAutoSize

Accusoft.ImagXpressSdk.AutoResizeType

AccusoftImagXpress13.enumZoomFit

Accusoft.ImagXpressSdk.ZoomToFitType

Original VB6 code:

Begin AccusoftImagXpress13Ctl.ImagXpress ImagXpress1
...
End
Begin AccusoftISISXpress7Ctl.ISISXpress ISISXpress1
...
End
Private Sub Command2_Click()
Me.ISISXpress1.CreateDib = True
Me.ISISXpress1.CreateFiles = True
Dim driver As String
Dim scanner As String
Dim r As String
r = Me.ISISXpress1.Root
Me.ISISXpress1.Cancel
Me.ISISXpress1.Cancel True
Me.ISISXpress1.Cancel False
Me.ISISXpress1.CancelImmediate
End Sub
Private Sub Form_Load()
Me.ImagXpress1.FileName = "Tulips.jpg"
Me.ImagXpress1.ZoomFactor = 1
Me.ImagXpress1.ZoomToFit ZOOMFIT_BEST
Me.ImagXpress1.DrawTextString 100, 100, "This is a sample", 0
Dim n As Integer
n = ImagXpress1.PageNbr
MsgBox n
n = ImagXpress1.Pages
MsgBox n
ImagXpress1.AutoSize = ISIZE_BestFit
MsgBox ImagXpress1.FileName
ImagXpress1.SaveFile
End Sub
Private Sub ISISXpress1_FeederEmpty(ByVal PageNumber As Long, StopScan As Boolean)
MsgBox PageNumber
End Sub

C# code:

public Accusoft.ImagXpressSdk.ImageXView ImagXpress1;
public Accusoft.ImagXpressSdk.ImagXpress ImagXpress1_Component;
public Accusoft.ISISXpressSdk.IsisXpress ISISXpress1;
...
this.ImagXpress1 = new Accusoft.ImagXpressSdk.ImageXView();
this.ImagXpress1_Component = new Accusoft.ImagXpressSdk.ImagXpress();
this.ISISXpress1 = new Accusoft.ISISXpressSdk.IsisXpress();
...
private void Command2_Click(Object eventSender, EventArgs eventArgs)
{
this.ISISXpress1.Output.CreateDib = true;
this.ISISXpress1.Output.CreateFiles = true;
string driver = "";
string scanner = "";
string r = this.ISISXpress1.Output.Root;
this.ISISXpress1.Scanner.Cancel();
this.ISISXpress1.Scanner.Cancel(true);
this.ISISXpress1.Scanner.Cancel(false);
this.ISISXpress1.Scanner.Cancel(true);
}
//UPGRADE_WARNING: (2080) Form_Load event was upgraded to Form_Load method and has a new behavior. private void Form_Load()
{
this.ImagXpress1.Image = Accusoft.ImagXpressSdk.ImageX.FromFile(ImagXpress1_Component, "Tulips.jpg");
this.ImagXpress1.ZoomFactor = 1;
this.ImagXpress1.ZoomToFit(Accusoft.ImagXpressSdk.ZoomToFitType.FitBest);
Graphics graphics = this.ImagXpress1.Image.GetGraphics();
graphics.DrawString("This is a sample", new Font(SystemFonts.DefaultFont.Name, SystemFonts.DefaultFont.Size), new SolidBrush(Color.Black), 100, 100);
this.ImagXpress1.Image.ReleaseGraphics(true);
int n = ImagXpress1.Image.Page;
MessageBox.Show(n.ToString(), AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()));
n = ImagXpress1.Image.PageCount;
MessageBox.Show(n.ToString(), AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()));
ImagXpress1.AutoResize = Accusoft.ImagXpressSdk.AutoResizeType.BestFit;
MessageBox.Show(ImagXpress1.Image.Filename, AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()));
//UPGRADE_ISSUE: (2064) AccusoftImagXpress13.ImagXpress method ImagXpress1.SaveFile was not upgraded.
ImagXpress1.SaveFile();
}
private void ISISXpress1_FeederEmpty(object eventSender, Accusoft.ISISXpressSdk.FeederEmptyEventArgs eventArgs)
{
int PageNumber = eventArgs.PageNumber;
bool StopScan = eventArgs.StopScan;
MessageBox.Show(PageNumber.ToString(), AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()));
}

VB.NET code:

Public WithEvents ImagXpress1 As Accusoft.ImagXpressSdk.ImageXView
Public WithEvents ImagXpress1_Component As Accusoft.ImagXpressSdk.ImagXpress
Public WithEvents ISISXpress1 As Accusoft.ISISXpressSdk.IsisXpress
...
Me.ImagXpress1 = New Accusoft.ImagXpressSdk.ImageXView()
Me.ImagXpress1_Component = New Accusoft.ImagXpressSdk.ImagXpress()
Me.ISISXpress1 = New Accusoft.ISISXpressSdk.IsisXpress()
...
Private Sub Command2_Click(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles Command2.Click
Me.ISISXpress1.Output.CreateDib = True
Me.ISISXpress1.Output.CreateFiles = True
Dim driver As String = "", scanner As String = ""
Dim r As String = Me.ISISXpress1.Output.Root
Me.ISISXpress1.Scanner.Cancel()
Me.ISISXpress1.Scanner.Cancel(True)
Me.ISISXpress1.Scanner.Cancel(False)
Me.ISISXpress1.Scanner.Cancel(True)
End Sub
'UPGRADE_WARNING: (2080) Form_Load event was upgraded to Form_Load method and has a new behavior.'
Private Sub Form_Load()
Me.ImagXpress1.Image = Accusoft.ImagXpressSdk.ImageX.FromFile(ImagXpress1_Component, "Tulips.jpg")
Me.ImagXpress1.ZoomFactor = 1
Me.ImagXpress1.ZoomToFit(Accusoft.ImagXpressSdk.ZoomToFitType.FitBest)
Dim graphics As Graphics = Me.ImagXpress1.Image.GetGraphics()
graphics.DrawString("This is a sample", New Font(SystemFonts.DefaultFont.Name, SystemFonts.DefaultFont.Size), New SolidBrush(Color.Black), 100, 100)
Me.ImagXpress1.Image.ReleaseGraphics(True)
Dim n As Integer = ImagXpress1.Image.Page
MessageBox.Show(CStr(n), My.Application.Info.Title)
n = ImagXpress1.Image.PageCount
MessageBox.Show(CStr(n), My.Application.Info.Title)
ImagXpress1.AutoResize = Accusoft.ImagXpressSdk.AutoResizeType.BestFit
MessageBox.Show(ImagXpress1.Image.Filename, My.Application.Info.Title)
'UPGRADE_ISSUE: (2064) AccusoftImagXpress13.ImagXpress method ImagXpress1.SaveFile was not upgraded.'
ImagXpress1.SaveFile()
End Sub
Private Sub ISISXpress1_FeederEmpty(ByVal eventSender As object, ByVal eventArgs As Accusoft.ISISXpressSdk.FeederEmptyEventArgs) Handles ISISXpress1.FeederEmpty
Dim PageNumber As Integer = eventArgs.PageNumber
Dim StopScan As Boolean = eventArgs.StopScan
MessageBox.Show(CStr(PageNumber), My.Application.Info.Title)
End Sub

1.2. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

Begin AccusoftImagXpress13Ctl.ImagXpress ImagXpress1
...
End
Begin AccusoftISISXpress7Ctl.ISISXpress ISISXpress1
...
End
Private Sub Command2_Click()
Me.ISISXpress1.CreateDib = True
Me.ISISXpress1.CreateFiles = True
Dim driver As String
Dim scanner As String
Dim r As String
r = Me.ISISXpress1.Root
Me.ISISXpress1.Cancel
Me.ISISXpress1.Cancel True
Me.ISISXpress1.Cancel False
Me.ISISXpress1.CancelImmediate
End Sub
Private Sub Form_Load()
Me.ImagXpress1.FileName = "Tulips.jpg"
Me.ImagXpress1.ZoomFactor = 1
Me.ImagXpress1.ZoomToFit ZOOMFIT_BEST
Me.ImagXpress1.DrawTextString 100, 100, "This is a sample", 0
Dim n As Integer
n = ImagXpress1.PageNbr
MsgBox n
n = ImagXpress1.Pages
MsgBox n
ImagXpress1.AutoSize = ISIZE_BestFit
MsgBox ImagXpress1.FileName
ImagXpress1.SaveFile
End Sub
Private Sub ISISXpress1_FeederEmpty(ByVal PageNumber As Long, StopScan As Boolean)
MsgBox PageNumber
End Sub

C# code:

public AxAccusoftImagXpress13.AxImagXpress ImagXpress1;
public AxAccusoftISISXpress7.AxISISXpress ISISXpress1;
...
this.ImagXpress1 = new AxAccusoftImagXpress13.AxImagXpress();
this.ISISXpress1 = new AxAccusoftISISXpress7.AxISISXpress();
...
private void Command2_Click(Object eventSender, EventArgs eventArgs)
{
this.ISISXpress1.CreateDib = true;
this.ISISXpress1.CreateFiles = true;
string driver = "";
string scanner = "";
string r = this.ISISXpress1.Root;
//UPGRADE_ISSUE: (2064) AccusoftISISXpress7.ISISXpress method ISISXpress1.Cancel was not upgraded.
this.ISISXpress1.Cancel(true);
//UPGRADE_ISSUE: (2064) AccusoftISISXpress7.ISISXpress method ISISXpress1.Cancel was not upgraded.
this.ISISXpress1.Cancel(true);
//UPGRADE_ISSUE: (2064) AccusoftISISXpress7.ISISXpress method ISISXpress1.Cancel was not upgraded.
this.ISISXpress1.Cancel(false);
this.ISISXpress1.CancelImmediate();
}
//UPGRADE_WARNING: (2080) Form_Load event was upgraded to Form_Load method and has a new behavior. private void Form_Load()
{
this.ImagXpress1.FileName = "Tulips.jpg";
this.ImagXpress1.ZoomFactor = 1;
this.ImagXpress1.ZoomToFit(AccusoftImagXpress13.enumZoomFit.ZOOMFIT_BEST);
this.ImagXpress1.DrawTextString(100, 100, "This is a sample", Convert.ToUInt32(0));
int n = ImagXpress1.PageNbr;
MessageBox.Show(n.ToString(), AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()));
n = ImagXpress1.Pages;
MessageBox.Show(n.ToString(), AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()));
ImagXpress1.CtlAutoSize = AccusoftImagXpress13.enumAutoSize.ISIZE_BestFit;
MessageBox.Show(ImagXpress1.FileName, AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()));
ImagXpress1.SaveFile();
}
private void ISISXpress1_FeederEmpty(Object eventSender, AxAccusoftISISXpress7._IISISXpressEvents_FeederEmptyEvent eventArgs)
{
MessageBox.Show(eventArgs.pageNumber.ToString(), AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()));
}

VB.NET code:

Public WithEvents ImagXpress1 As AxAccusoftImagXpress13.AxImagXpress
Public WithEvents ISISXpress1 As AxAccusoftISISXpress7.AxISISXpress
...
Me.ImagXpress1 = New AxAccusoftImagXpress13.AxImagXpress()
Me.ISISXpress1 = New AxAccusoftISISXpress7.AxISISXpress()
...
Private Sub Command2_Click(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles Command2.Click
Me.ISISXpress1.CreateDib = True
Me.ISISXpress1.CreateFiles = True
Dim driver As String = "", scanner As String = ""
Dim r As String = Me.ISISXpress1.Root
'UPGRADE_ISSUE: (2064) AccusoftISISXpress7.ISISXpress method ISISXpress1.Cancel was not upgraded.'
Me.ISISXpress1.Cancel()
'UPGRADE_ISSUE: (2064) AccusoftISISXpress7.ISISXpress method ISISXpress1.Cancel was not upgraded.'
Me.ISISXpress1.Cancel(True)
'UPGRADE_ISSUE: (2064) AccusoftISISXpress7.ISISXpress method ISISXpress1.Cancel was not upgraded.'
Me.ISISXpress1.Cancel(False)
Me.ISISXpress1.CancelImmediate()
End Sub
'UPGRADE_WARNING: (2080) Form_Load event was upgraded to Form_Load method and has a new behavior. Private Sub Form_Load()'
Me.ImagXpress1.FileName = "Tulips.jpg"
Me.ImagXpress1.ZoomFactor = 1
Me.ImagXpress1.ZoomToFit(AccusoftImagXpress13.enumZoomFit.ZOOMFIT_BEST)
Me.ImagXpress1.DrawTextString(100, 100, "This is a sample", Convert.ToUInt32(0))
Dim n As Integer = ImagXpress1.PageNbr
MessageBox.Show(CStr(n), My.Application.Info.Title)
n = ImagXpress1.Pages
MessageBox.Show(CStr(n), My.Application.Info.Title)
ImagXpress1.CtlAutoSize = AccusoftImagXpress13.enumAutoSize.ISIZE_BestFit
MessageBox.Show(ImagXpress1.FileName, My.Application.Info.Title)
ImagXpress1.SaveFile()
End Sub
Private Sub ISISXpress1_FeederEmpty(ByVal eventSender As Object, ByVal eventArgs As AxAccusoftISISXpress7._IISISXpressEvents_FeederEmptyEvent) Handles ISISXpress1.FeederEmpty
MessageBox.Show(CStr(eventArgs.pageNumber), My.Application.Info.Title)
End Sub

2. ActiveBarLibrary

2.1. To DevExpress.XtraBars

Convert ActiveBar2Library.ActiveBar2 classes to DevExpress.XtraBars.BarManager.

By using this option the converted application will not have any reference to the COM Component.

Class

Maps to

ActiveBar2Library.ActiveBar2.BackColor

DevExpress.XtraBars.BarManager.GetBackColor

ActiveBar2Library.ActiveBar2.ForeColor

DevExpress.XtraBars.BarManager.GetForeColor

ActiveBar2Library.ActiveBar2.Font

DevExpress.XtraBars.BarManager.GetFont

ActiveBar2Library.ActiveBar2.DisplayKeysInToolTip

DevExpress.XtraBars.BarManager.ShowShorcutInScreenTips

ActiveBar2Library.ActiveBar2.DisplayToolTips

DevExpress.XtraBars.BarManager.ToolTipController

ActiveBar2Library.ActiveBar2.Enabled

DevExpress.XtraBars.BarManager.GetEnabled

ActiveBar2Library.ActiveBar2.Bands

DevExpress.XtraBars.BarManager.Bars

Original VB6 code:

Private Sub Form_Load()
...
X1 = Me.ActiveBar1.ForeColor
X2 = Me.ActiveBar1.Font
Me.ActiveBar1.DisplayKeysInToolTip = False
Me.ActiveBar1.DisplayToolTips = True
End Sub

C# code:

private void Form_Load()
{
Color X1 = this.ActiveBarHelper1.GetForeColor(this.ActiveBar1);
string X2 = this.ActiveBarHelper1.GetFont(this.ActiveBar1).Name;
this.ActiveBar1.ShowShortcutInScreenTips = false;
this.ActiveBar1.ToolTipController.Active = true;
}

VB.NET code:

Private Sub Form_Load()
Dim X1 As Color = Me.ActiveBarHelper1.GetForeColor(Me.ActiveBar1)
Dim X2 As String = Me.ActiveBarHelper1.GetFont(Me.ActiveBar1).Name
Me.ActiveBar1.ShowShortcutInScreenTips = False
Me.ActiveBar1.ToolTipController.Active = True
End Sub

2.2. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

Private Sub Form_Load()
...
X1 = Me.ActiveBar1.ForeColor
X2 = Me.ActiveBar1.Font
Me.ActiveBar1.DisplayKeysInToolTip = False
Me.ActiveBar1.DisplayToolTips = True
End Sub

C# code:

private void Form_Load()
{
Color X1 = this.ActiveBarHelper1.GetForeColor(this.ActiveBar1);
string X2 = this.ActiveBarHelper1.GetFont(this.ActiveBar1).Name;
this.ActiveBar1.ShowShortcutInScreenTips = false;
this.ActiveBar1.ToolTipController.Active = true;
}

VB.NET code:

Private Sub Form_Load()
Dim X1 As Color = Me.ActiveBarHelper1.GetForeColor(Me.ActiveBar1)
Dim X2 As String = Me.ActiveBarHelper1.GetFont(Me.ActiveBar1).Name
Me.ActiveBar1.ShowShortcutInScreenTips = False
Me.ActiveBar1.ToolTipController.Active = True
End Sub

3. Component One Elastic

3.1. To System.Windows.Forms.Panel

This option will port the legacy COM control into the resulting application as a System.Windows.Forms.Panel control.

By using this option the converted application will not have any reference to the COM Component.

Original VB6 code:

Begin VB.Form Form1
...
Begin C1SizerLibCtl.C1Elastic C1Elastic1
...
End
End
Private Sub Form_Load()
Dim ctl As C1Elastic
Set ctl = C1Elastic1
ctl.Align = asFill
ctl.Width = 200
ctl.Top = 3000
ctl.Enabled = False
End Sub

C# code:

partial class Form1
{
...
public System.Windows.Forms.Panel C1Elastic1;
...
private void InitializeComponent()
{
...
this.C1Elastic1 = new System.Windows.Forms.Panel();
...
}
}
private void Form_Load()
{
Panel ctl = C1Elastic1;
ctl.Dock = DockStyle.Fill;
ctl.Width = 200;
ctl.Top = 3000;
ctl.Enabled = false;
}

VB.NET code:

Partial Class Form1
...
Public WithEvents C1Elastic1 As System.Windows.Forms.Panel
...
Private Sub InitializeComponent()
...
Me.C1Elastic1 = New System.Windows.Forms.Panel()
...
Private Sub Form_Load()
Dim ctl As Panel = C1Elastic1
ctl.Dock = DockStyle.Fill
ctl.Width = 200
ctl.Top = 3000
ctl.Enabled = False
End Sub

3.2. To ComponentOne controls

This option will port the legacy COM control into the resulting application as a System.Windows.Forms.Panel control, along with a C1SizerLight control attached to the resulting form which handles the proportional resizing of all the controls in the form, including the mapped panel.

By using this option the converted application will not have any reference to the COM Component.

Original VB6 code:

Begin VB.Form Form1
...
Begin C1SizerLibCtl.C1Elastic C1Elastic1
...
End
End
Private Sub Form_Load()
Dim ctl As C1Elastic
Set ctl = C1Elastic1
ctl.Align = asFill
ctl.Width = 200
ctl.Top = 3000
ctl.Enabled = False
End Sub

C# code:

partial class Form1
{
...
public System.Windows.Forms.Panel C1Elastic1;
C1.Win.C1Sizer.C1SizerLight c1sizerlight = null;
...
private void InitializeComponent()
{
...
this.C1Elastic1 = new System.Windows.Forms.Panel();
this.c1sizerlight = new C1.Win.C1Sizer.C1SizerLight(this.components);
...
}
}
private void Form_Load()
{
Panel ctl = C1Elastic1;
ctl.Dock = DockStyle.Fill;
ctl.Width = 200;
ctl.Top = 3000;
ctl.Enabled = false;
}

VB.NET code:

Partial Class Form1
...
Public WithEvents C1Elastic1 As System.Windows.Forms.Panel
Dim c1sizerlight As C1.Win.C1Sizer.C1SizerLight
...
Private Sub InitializeComponent()
...
Me.C1Elastic1 = New System.Windows.Forms.Panel()
Me.c1sizerlight = New C1.Win.C1Sizer.C1SizerLight(Me.components)
...
Private Sub Form_Load()
Dim ctl As Panel = C1Elastic1
ctl.Dock = DockStyle.Fill
ctl.Width = 200
ctl.Top = 3000
ctl.Enabled = False
End Sub

3.3. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

Private Sub Form_Load()
...
X1 = Me.ActiveBar1.ForeColor
X2 = Me.ActiveBar1.Font
Me.ActiveBar1.DisplayKeysInToolTip = False
Me.ActiveBar1.DisplayToolTips = True
End Sub

C# code:

partial class Form1
{
...
public System.Windows.Forms.Panel C1Elastic1;
C1.Win.C1Sizer.C1SizerLight c1sizerlight = null;
...
private void InitializeComponent()
{
...
this.C1Elastic1 = new System.Windows.Forms.Panel();
this.c1sizerlight = new C1.Win.C1Sizer.C1SizerLight(this.components);
...
}
}
private void Form_Load()
{
Panel ctl = C1Elastic1;
ctl.Dock = DockStyle.Fill;
ctl.Width = 200;
ctl.Top = 3000;
ctl.Enabled = false;
}

VB.NET code:

Partial Class Form1
...
Public WithEvents C1Elastic1 As System.Windows.Forms.Panel
Dim c1sizerlight As C1.Win.C1Sizer.C1SizerLight
...
Private Sub InitializeComponent()
...
Me.C1Elastic1 = New System.Windows.Forms.Panel()
Me.c1sizerlight = New C1.Win.C1Sizer.C1SizerLight(Me.components)
...
Private Sub Form_Load()
Dim ctl As Panel = C1Elastic1
ctl.Dock = DockStyle.Fill
ctl.Width = 200
ctl.Top = 3000
ctl.Enabled = False
End Sub

4. Component One Tab

4.1. To System.Windows.Forms.TabControl

This option will port the legacy COM control into the resulting application as a System.Windows.Forms.TabControl control.

By using this option the converted application will not have any reference to the COM Component.

Original VB6 code:

Private Sub Form_Load()
Dim ctl As C1Tab
Dim boolValue As Boolean
Dim numTab As Integer
Set ctl = C1Tab1
ctl.Align = asFill
ctl.Width = 200
ctl.Top = 3000
ctl.Enabled = False
ctl.CurrTab = 4
ctl.AddTab "Hola2", Me.C1Tab1.NumTabs
numTab = ctl.NumTabs
boolValue = ctl.TabVisible(1)
boolValue = ctl.TabEnabled(1)
ctl.AttachPageToTab Me.Command2, Me.C1Tab1.NumTabs - 1
ctl.Move 1000, 1000, 1000, 1000
End Sub

C# code:

private void Form_Load()
{
TabControl ctl = C1Tab1;
ctl.setAlign(DockStyle.Fill);
ctl.Width = 200;
ctl.Top = 3000;
ctl.Enabled = false;
ctl.SelectedIndex = 4;
ctl.TabPages.Insert(this.C1Tab1.TabCount, "Hola2");
int numTab = ctl.TabCount;
bool boolValue = ctl.TabPages[1].Visible;
boolValue = ctl.TabPages[1].Enabled;
ctl.TabPages[this.C1Tab1.TabCount - 1].Controls.Add(this.Command2);
this.Command2.Dock = DockStyle.Fill;
ctl.SetBounds(67, 67, 67, 67);
}

VB.NET code:

Private Sub Form_Load()
Dim ctl As TabControl = C1Tab1
ctl.setAlign(DockStyle.Fill)
ctl.Width = 200
ctl.Top = 3000
ctl.Enabled = False
ctl.SelectedIndex = 4
ctl.TabPages.Insert(Me.C1Tab1.TabCount, "Hola2")
Dim numTab As Integer = ctl.TabCount
Dim boolValue As Boolean = ctl.TabPages(1).Visible
boolValue = ctl.TabPages(1).Enabled
ctl.TabPages(Me.C1Tab1.TabCount - 1).Controls.Add(Me.Command2)
Me.Command2.Dock = DockStyle.Fill
ctl.SetBounds(67, 67, 67, 67)
End Sub

4.2. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

Private Sub Form_Load()
Dim ctl As C1Tab
Dim boolValue As Boolean
Dim numTab As Integer
Set ctl = C1Tab1
ctl.Align = asFill
ctl.Width = 200
ctl.Top = 3000
ctl.Enabled = False
ctl.CurrTab = 4
ctl.AddTab "Hola2", Me.C1Tab1.NumTabs
numTab = ctl.NumTabs
boolValue = ctl.TabVisible(1)
boolValue = ctl.TabEnabled(1)
ctl.AttachPageToTab Me.Command2, Me.C1Tab1.NumTabs - 1
ctl.Move 1000, 1000, 1000, 1000
End Sub

C# code:

private void Form_Load()
{
AxC1SizerLib.AxC1Tab ctl = C1Tab1;
ctl.Align = DockStyle.Fill;
ctl.Width = 200;
ctl.Top = 3000;
ctl.Enabled = false;
ctl.CurrTab = 4;
ctl.AddTab("Hola2", this.C1Tab1.NumTabs, null);
int numTab = ctl.NumTabs;
bool boolValue = ctl.get_TabVisible(1);
boolValue = ctl.get_TabEnabled(1);
ctl.AttachPageToTab(this.Command2, this.C1Tab1.NumTabs - 1);
ctl.Move(1000, 1000, 1000, 1000);
}

VB.NET code:

Private Sub Form_Load()
Dim ctl As AxC1SizerLib.AxC1Tab = C1Tab1
ctl.Align = DockStyle.Fill
ctl.Width = 200
ctl.Top = 3000
ctl.Enabled = False
ctl.CurrTab = 4
ctl.AddTab("Hola2", Me.C1Tab1.NumTabs)
Dim numTab As Integer = ctl.NumTabs
Dim boolValue As Boolean = ctl.TabVisible(1)
boolValue = ctl.TabEnabled(1)
ctl.AttachPageToTab(Me.Command2, Me.C1Tab1.NumTabs - 1)
ctl.Move(1000, 1000, 1000, 1000)
End Sub

5. COMSVCSLib

5.1. To System.EnterpriseServices

Map COMSVCSLib classes and members to their .NET equivalents in System.EnterpriseServices

Class

Maps to

ObjectContext

System.EnterpriseServices.ContextUtil

SharedPropertyGroupManager

System.EnterpriseServices.SharedPropertyGroupManager

SecurityProperty

System.EnterpriseServices.SecurityCallContext

SharedProperty

System.EnterpriseServices.SharedProperty

SharedPropertyGroup

System.EnterpriseServices.SharedPropertyGroup

Original VB6 code:

Implements ObjectControl
Private Sub ObjectControl_Activate()
End Sub
Private Function ObjectControl_CanBePooled() As Boolean
ObjectControl_CanBePooled = True
End Function
Private Sub ObjectControl_Deactivate()
End Sub

C# code:

public class clsLogon: System.EnterpriseServices.ServicedComponent
{
protected override void Activate()
{
}
protected override bool CanBePooled()
{
return true;
}
protected override void Deactivate()
{
}
}

VB.NET code:

Public Class clsLogon Inherits System.EnterpriseServices.ServicedComponent
Private Sub ObjectControl_Activate() Implements COMSVCSLib.ObjectControl.Activate
End Sub
Private Function ObjectControl_CanBePooled() As Boolean Implements COMSVCSLib.ObjectControl.CanBePooled
Return True
End Function
Private Sub ObjectControl_Deactivate() Implements COMSVCSLib.ObjectControl.Deactivate
End Sub

5.2. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

Implements ObjectControl
Private Sub ObjectControl_Activate()
End Sub
Private Function ObjectControl_CanBePooled() As Boolean
ObjectControl_CanBePooled = True
End Function
Private Sub ObjectControl_Deactivate()
End Sub

C# code:

public class clsLogon: COMSVCSLib.ObjectControl
{
public void Activate()
{
}
public bool CanBePooled()
{
return true;
}
public void Deactivate()
{
}
}

VB.NET code:

Public Class clsLogon Implements COMSVCSLib.ObjectControl
Private Sub ObjectControl_Activate() Implements COMSVCSLib.ObjectControl.Activate
End Sub
Private Function ObjectControl_CanBePooled() As Boolean Implements COMSVCSLib.ObjectControl.CanBePooled
Return True
End Function
Private Sub ObjectControl_Deactivate() Implements COMSVCSLib.ObjectControl.Deactivate
End Sub

6. CRAXDRT_CRVIEWERLibCtl

6.1. To CrystalReports

By using this option the converted application will not have any reference to the COM Component.

Map CRAXDRT and CRVIEWERLibCtl classes and enums to CrystalReports equivalents.

Class

Maps to

CRAXDRT.Report

CrystalDecisions.CrystalReports.Engine.ReportDocument

CRAXDRT.IFormulaFieldDefinitions

CrystalDecisions.CrystalReports.Engine.FormulaFieldDefinition

CRAXDRT.Report.FormulaFields

CrystalDecisions.CrystalReports.Engine.ReportDocument.DateDefinition.FormulaFields

CRAXDRT.Report.DiscardSavedData

CrystalDecisions.CrystalReports.Engine.ReportDocument.Refresh

CRAXDRT.Report.PrinterDuplex

CrystalDecisions.CrystalReports.Engine.ReportDocument.PrintOptions.PrinterDuplex

CRAXDRT.Report.PaperOrientation

CrystalDecisions.CrystalReports.Engine.ReportDocument.PrintOptions.PaperOrientation

CRAXDRT.Report.ReportTitle

CrystalDecisions.CrystalReports.Engine.ReportDocument.SummaryInfo.ReportTitle

CRAXDRT.Report.Sections

CrystalDecisions.CrystalReports.Engine.ReportDocument.ReportDefinition.Sections

CRAXDRT.FormulaFields

CrystalDecisions.CrystalReports.Engine.FormulaFieldDefinition

CRAXDRT.Section

CrystalDecisions.CrystalReports.Engine.Section

CRAXDRT.ReportObjects

CrystalDecisions.CrystalReports.Engine.ReportObjects

CRAXDRT.SubreportObject

CrystalDecisions.CrystalReports.Engine.SubreportObject

CRVIEWERLib.CRViewer

CrystalDecisions.Windows.Forms.CrystalReportViewer

Original VB6 code:

Private Sub Form_Load()
Dim objReport As CRAXDRT.Report
objReport = objApplication.OpenReport(App.Path & "Report.rpt", 1)
objReport.DiscardSavedData
End Sub

C# code:

private void Form_Load()
{
CrystalDecisions.CrystalReports.Engine.ReportDocument tempReport = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
tempReport.Load(Path.GetDirectoryName(Application.ExecutablePath) + "Report.rpt");
CrystalDecisions.CrystalReports.Engine.ReportDocument objReport = (CrystalDecisions.CrystalReports.Engine.ReportDocument) tempReport;
objReport.Refresh();
}

VB.NET code:

Private Sub Form_Load()
Dim tempReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
tempReport.Load(My.Application.Info.DirectoryPath & "Report.rpt")
Dim objReport As CrystalDecisions.CrystalReports.Engine.ReportDocument = tempReport
objReport.Refresh()
End Sub

6.2. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

Private Sub Form_Load()
Dim objReport As CRAXDRT.Report
objReport = objApplication.OpenReport(App.Path & "Report.rpt", 1)
objReport.DiscardSavedData
End Sub

C# code:

private void Form_Load()
{
CRAXDRT.Report objReport = (CRAXDRT.Report) objApplication.OpenReport(Path.GetDirectoryName(Application.ExecutablePath) + "Report.rpt", 1);
objReport.DiscardSavedData();
}

VB.NET code:

Private Sub Form_Load()
Dim objReport As CRAXDRT.Report = objApplication.OpenReport(My.Application.Info.DirectoryPath & "Report.rpt", 1)
objReport.DiscardSavedData()
End Sub

7. CrystalReport

7.1. To CrystalReport.NET

Conversion of CrystalReport for Windows Forms using a helper class.

General Description:

CrystalReport is a business intelligence application, marketed to small and medium businesses. It allows the user to generate reports based on databases generated within Visual Basic.

Deployment Note:

The VBUC converts the CrystalReport OCX to a helper class.

Class

Maps to

Crystal.CrystalReport

UpgradeHelper.CrystalReport.CrystalReportHelper

Original VB6 code:

CrystalReport1.ReportFileName = App.Path & "/Test.rpt"
CrystalReport1.Connect = "DSN=" & "kc-qa" & ";uid=" & "sa" & ";pwd=" & "administrator"
CrystalReport1.Destination = crptToWindow
CrystalReport1.Formulas(0) = "{address.country} = '{?param1}'"
CrystalReport1.ParameterFields(0) = "param1;Costa Rica;TRUE"
CrystalReport1.SortFields(0) = "+ {address.line1}"
CrystalReport1.SQLQuery = "SELECT address.line1, address.line2, address.city, address.province, address.postcode, address.country FROM BMTAnonymized.dbo.address address WHERE province = 'ON'"
CrystalReport1.SubreportToChange = "MySubreport"
CrystalReport1.Formulas(0) = "{address.city} = '{?param1}'"
CrystalReport1.SubreportToChange = ""
CrystalReport1.Action = 1
CrystalReport1.Reset

C# code:

...
CrystalReport1.ReportFileName = Path.GetDirectoryName(Application.ExecutablePath) + "/Test.rpt";
CrystalReport1.Connect = "DSN=" + "kc-qa" + ";uid=" + "sa" + ";pwd=" + "administrator";
CrystalReport1.Destination = UpgradeHelpers.CrystalReport.CrystalReportHelper.DestinationConstants.crptToWindow;
CrystalReport1.FormulasValue(0, "{address.country} = '{?param1}'");
CrystalReport1.ParameterFieldsValue(0, "param1;Costa Rica;TRUE");
CrystalReport1.SortFieldsValue(0, "+ {address.line1}");
CrystalReport1.SQLQuery = "SELECT address.line1, address.line2, address.city, address.province, address.postcode, address.country FROM BMTAnonymized.dbo.address address WHERE province = 'ON'";
CrystalReport1.SubreportToChange = "MySubreport";
CrystalReport1.FormulasValue(0, "{address.city} = '{?param1}'");
CrystalReport1.SubreportToChange = "";
CrystalReport1.Action = 1;
CrystalReport1.Reset();

VB.NET code:

...
CrystalReport1.ReportFileName = My.Application.Info.DirectoryPath & "/Test.rpt"
CrystalReport1.Connect = "DSN=" & "kc-qa" & ";uid=" & "sa" & ";pwd=" & "administrator"
CrystalReport1.Destination = UpgradeHelpers.CrystalReport.CrystalReportHelper.DestinationConstants.crptToWindow
CrystalReport1.FormulasValue(0, "{address.country} = '{?param1}'")
CrystalReport1.ParameterFieldsValue(0, "param1;Costa Rica;TRUE")
CrystalReport1.SortFieldsValue(0, "+ {address.line1}")
CrystalReport1.SQLQuery = "SELECT address.line1, address.line2, address.city, address.province, address.postcode, address.country FROM BMTAnonymized.dbo.address address WHERE province = 'ON'"
CrystalReport1.SubreportToChange = "MySubreport"
CrystalReport1.FormulasValue(0, "{address.city} = '{?param1}'")
CrystalReport1.SubreportToChange = ""
CrystalReport1.Action = 1
CrystalReport1.Reset()
...

7.2. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

CrystalReport1.ReportFileName = App.Path & "/Test.rpt"
CrystalReport1.Connect = "DSN=" & "kc-qa" & ";uid=" & "sa" & ";pwd=" & "administrator"
CrystalReport1.Destination = crptToWindow
CrystalReport1.Formulas(0) = "{address.country} = '{?param1}'"
CrystalReport1.ParameterFields(0) = "param1;Costa Rica;TRUE"
CrystalReport1.SortFields(0) = "+ {address.line1}"
CrystalReport1.SQLQuery = "SELECT address.line1, address.line2, address.city, address.province, address.postcode, address.country FROM BMTAnonymized.dbo.address address WHERE province = 'ON'"
CrystalReport1.SubreportToChange = "MySubreport"
CrystalReport1.Formulas(0) = "{address.city} = '{?param1}'"
CrystalReport1.SubreportToChange = ""
CrystalReport1.Action = 1
CrystalReport1.Reset

C# code:

...
CrystalReport1.ReportFileName = Path.GetDirectoryName(Application.ExecutablePath) + "/Test.rpt";
CrystalReport1.Connect = "DSN=" + "kc-qa" + ";uid=" + "sa" + ";pwd=" + "administrator";
CrystalReport1.Destination = UpgradeHelpers.CrystalReport.CrystalReportHelper.DestinationConstants.crptToWindow;
CrystalReport1.FormulasValue(0, "{address.country} = '{?param1}'");
CrystalReport1.ParameterFieldsValue(0, "param1;Costa Rica;TRUE");
CrystalReport1.SortFieldsValue(0, "+ {address.line1}");
CrystalReport1.SQLQuery = "SELECT address.line1, address.line2, address.city, address.province, address.postcode, address.country FROM BMTAnonymized.dbo.address address WHERE province = 'ON'";
CrystalReport1.SubreportToChange = "MySubreport";
CrystalReport1.FormulasValue(0, "{address.city} = '{?param1}'");
CrystalReport1.SubreportToChange = "";
CrystalReport1.Action = 1;
CrystalReport1.Reset();

VB.NET code:

...
CrystalReport1.ReportFileName = My.Application.Info.DirectoryPath & "/Test.rpt"
CrystalReport1.Connect = "DSN=" & "kc-qa" & ";uid=" & "sa" & ";pwd=" & "administrator"
CrystalReport1.Destination = UpgradeHelpers.CrystalReport.CrystalReportHelper.DestinationConstants.crptToWindow
CrystalReport1.FormulasValue(0, "{address.country} = '{?param1}'")
CrystalReport1.ParameterFieldsValue(0, "param1;Costa Rica;TRUE")
CrystalReport1.SortFieldsValue(0, "+ {address.line1}")
CrystalReport1.SQLQuery = "SELECT address.line1, address.line2, address.city, address.province, address.postcode, address.country FROM BMTAnonymized.dbo.address address WHERE province = 'ON'"
CrystalReport1.SubreportToChange = "MySubreport"
CrystalReport1.FormulasValue(0, "{address.city} = '{?param1}'")
CrystalReport1.SubreportToChange = ""
CrystalReport1.Action = 1
CrystalReport1.Reset()
...

8. CSTextLib

8.1. To System.Windows.Forms controls

By using this option the converted application will not have any reference to the COM Component.

Map CSTextLib classes and enums to System.Windows.Forms equivalent.

Class

Maps to

CSTextLib.sicrEdit

System.Windows.Forms.MaskedTextBox

CSTextLib.sicrEdit.BorderEffect

System.Windows.Forms.MaskedTextBox.BorderStyle

CSTextLib.sidbEdit

System.Windows.Forms.MaskedTextBox

CSTextLib.sidbEdit.SelLength

System.Windows.Forms.MaskedTextBox.SelectionLength

CSTextLib.sidbEdit.SelStart

System.Windows.Forms.MaskedTextBox.SelectionStart

CSTextLib.sidbEdit.Text

System.Windows.Forms.MaskedTextBox.Text

CSTextLib.sidtEdit

System.Windows.Forms.DateTimePicker

CSTextLib.sidtEdit.Justification

System.Windows.Forms.DateTimePicker.TextAlign

CSTextLib.silgEdit

System.Windows.Forms.MaskedTextBox

CSTextLib.silgEdit.Enabled

System.Windows.Forms.MaskedTextBox.Enabled

CSTextLib.sitmEdit

System.Windows.Forms.MaskedTextBox

CSTextLib.sitmEdit.Value

System.Windows.Forms.MaskedTextBox.Text

CSTextLib.sitxEdit

System.Windows.Forms.TextBox

CSTextLib.sitxEdit.Mask

System.Windows.Forms.TextBox.Mask

CSTextLib.enumBE

System.Windows.Forms.BorderStyle

CSTextLib.enumJU

System.Windows.Forms.HorizontalAlignment

Original VB6 code:

Private Sub Form_Load()
Dim newSidbEdit As CSTextLibCtl.sidbEdit
newSidbEdit.Text = "Hello"
newSidbEdit.Enabled = True
newSidbEdit.Visible = True
newSidbEdit.TabIndex = 4
End Sub

C# code:

private void Form_Load()
{
MaskedTextBox newSidbEdit = null;
newSidbEdit.Text = "Hello";
newSidbEdit.Enabled = true;
newSidbEdit.Visible = true;
newSidbEdit.TabIndex = 4;
}

VB.NET code:

Private Sub Form_Load()
Dim newSidbEdit As MaskedTextBox
newSidbEdit.Text = "Hello"
newSidbEdit.Enabled = True
newSidbEdit.Visible = True
newSidbEdit.TabIndex = 4
End Sub

8.2. To ComponentOne C1Input controls

By using this option, the converted application will not have any reference to the COM Component.

This option maps:

  • CSTextLib classes to a Component One Winforms control equivalent.

  • CSTextLib enums to System.Windows.Forms enums.

Class

Maps to

CSTextLib.sicrEdit

C1.Win.C1Input.C1NumericEdit

CSTextLib.sicrEdit.BorderEffect

C1.Win.C1Input.C1NumericEdit.BorderStyle

CSTextLib.sidbEdit

C1.Win.C1Input.C1NumericEdit

CSTextLib.sidbEdit.SelLength

C1.Win.C1Input.C1NumericEdit.SelectionLength

CSTextLib.sidbEdit.SelStart

C1.Win.C1Input.C1NumericEdit.SelectionStart

CSTextLib.sidbEdit.Text

C1.Win.C1Input.C1NumericEdit.Text

CSTextLib.sidtEdit

C1.Win.C1Input.C1DateEdit

CSTextLib.sidtEdit.Justification

C1.Win.C1Input.C1DateEdit.TextAlign

CSTextLib.silgEdit

C1.Win.C1Input.C1NumericEdit

CSTextLib.silgEdit.Enabled

C1.Win.C1Input.C1NumericEdit.Enabled

CSTextLib.sitmEdit

C1.Win.C1Input.C1DateEdit

CSTextLib.sitmEdit.Value

C1.Win.C1Input.C1DateEdit.Value

CSTextLib.sitxEdit

C1.Win.C1Input.C1TextBox

CSTextLib.sitxEdit.Mask

C1.Win.C1Input.C1TextBox.EditMask

CSTextLib.enumBE

System.Windows.Forms.BorderStyle

CSTextLib.enumJU

System.Windows.Forms.HorizontalAlignment

Original VB6 code:

Private Sub Form_Load()
Dim newSidbEdit As CSTextLibCtl.sidbEdit
newSidbEdit.Text = "Hello"
newSidbEdit.Enabled = True
newSidbEdit.Visible = True
newSidbEdit.TabIndex = 4
End Sub

C# code:

private void Form_Load()
{
C1.Win.C1Input.C1NumericEdit newSidbEdit = null;
newSidbEdit.Text = "Hello";
newSidbEdit.Enabled = true;
newSidbEdit.Visible = true;
newSidbEdit.TabIndex = 4;
}

VB.NET code:

Private Sub Form_Load()
Dim newSidbEdit As C1.Win.C1Input.C1NumericEdit
newSidbEdit.Text = "Hello"
newSidbEdit.Enabled = True
newSidbEdit.Visible = True
newSidbEdit.TabIndex = 4
End Sub

8.3. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

Private Sub Form_Load()
Dim newSidbEdit As CSTextLibCtl.sidbEdit
newSidbEdit.Text = "Hello"
newSidbEdit.Enabled = True
newSidbEdit.Visible = True
newSidbEdit.TabIndex = 4
End Sub

C# code:

private void Form_Load()
{
CSTextLib.sidbEdit newSidbEdit = null;
newSidbEdit.Text = "Hello";
newSidbEdit.Enabled = true;
ReflectionHelper.LetMember(newSidbEdit, "Visible", true);
ReflectionHelper.LetMember(newSidbEdit, "TabIndex", 4);
}

VB.NET code:

Private Sub Form_Load()
Dim newSidbEdit As CSTextLib.sidbEdit
newSidbEdit.Text = "Hello"
newSidbEdit.Enabled = True
ReflectionHelper