Microsoft

This section includes options to upgrade the common controls created by Microsoft and shipped with Visual Basic 6.0.

All these options have two choices: to upgrade using COM Interop and to upgrade using .NET native components. In general, it is recommended to use the .NET native components, although in some cases there might be some manual changes required to achieve functional equivalence.

1. MSACAL

Microsoft Calendar Control control.

1.1. To System.Windows.Forms.MonthCalendar

Convert MSACAL.Calendar to a .NET equivalent control.

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

Class

Maps to

MSACAL.Calendar

System.Windows.Forms.MonthCalendar

Original VB6 code:

Begin VB.Form Form1
...
	Begin MSACAL.Calendar Calendar1 
		Height          =   2895
		Left            =   120
		TabIndex        =   0
		Top             =   120
		Width           =   4335
		...
	End	
End

C# code:

partial class Form1
{
	...
	public System.Windows.Forms.MonthCalendar Calendar1;
	...
	private void InitializeComponent()
	{
		...
		this.Calendar1 = new System.Windows.Forms.MonthCalendar();
		...
		// 
		//Calendar1
		// 
		this.Calendar1.AllowDrop = true;
		this.Calendar1.BackColor = System.Drawing.SystemColors.Control;
		this.Calendar1.FirstDayOfWeek = System.Windows.Forms.Day.Sunday;
		this.Calendar1.Font = new System.Drawing.Font("Arial", 8.25f, System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.Calendar1.Font = new System.Drawing.Font("Arial", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.Calendar1.Font = new System.Drawing.Font("Arial", 12f, System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.Calendar1.Location = new System.Drawing.Point(88, 56);
		this.Calendar1.Name = "Calendar1";
		this.Calendar1.TabIndex = 0;
		this.Calendar1.TitleForeColor = System.Drawing.Color.Black;
		this.Calendar1.TitleForeColor = System.Drawing.Color.FromArgb(0, 0, 160);
		this.Calendar1.Width = 113;
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents Calendar1 As System.Windows.Forms.MonthCalendar
	...
	Private Sub InitializeComponent()
		...
		Me.Calendar1 = New System.Windows.Forms.MonthCalendar()
		...
		' 
		'Calendar1
		' 
		Me.Calendar1.AllowDrop = True
		Me.Calendar1.BackColor = System.Drawing.SystemColors.Control
		Me.Calendar1.FirstDayOfWeek = System.Windows.Forms.Day.Sunday
		Me.Calendar1.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)
		Me.Calendar1.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)
		Me.Calendar1.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)
		Me.Calendar1.Location = New System.Drawing.Point(88, 56)
		Me.Calendar1.Name = "Calendar1"
		Me.Calendar1.TabIndex = 0
		Me.Calendar1.TitleForeColor = System.Drawing.Color.Black
		Me.Calendar1.TitleForeColor = System.Drawing.Color.FromArgb(0, 0, 160)
		Me.Calendar1.Width = 113

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 VB.Form Form1
...
	Begin MSACAL.Calendar Calendar1 
		Height          =   2895
		Left            =   120
		TabIndex        =   0
		Top             =   120
		Width           =   4335
		...
	End	
End

C# code:

partial class Form1
{
	...
	public  AxMSACAL.AxCalendar Calendar1;
	...
	private void  InitializeComponent()
	{
		...
		this.Calendar1 = new AxMSACAL.AxCalendar();
		this.Calendar1.Location = new System.Drawing.Point(8, 8);
		this.Calendar1.Name = "Calendar1";
		this.Calendar1.OcxState = (System.Windows.Forms.AxHost.State) resources.GetObject("Calendar1.OcxState");
		this.Calendar1.ScrollBars = RichTextLib.ScrollBarsConstants.rtfNone;
		this.Calendar1.Size = new System.Drawing.Size(289, 193);
		this.Calendar1.TabIndex = 0;
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents Calendar1 As AxMSACAL.AxCalendar
	...
	Private Sub InitializeComponent()
		...
		Me.Calendar1.AllowDrop = True
		Me.Calendar1.Location = New System.Drawing.Point(88, 56)
		Me.Calendar1.Name = "Calendar1"
		Me.Calendar1.OcxState = CType(resources.GetObject("Calendar1.OcxState"), System.Windows.Forms.AxHost.State)
		Me.Calendar1.Size = New System.Drawing.Size(113, 89)
		Me.Calendar1.TabIndex = 0
		...

2. MSComCt2

Microsoft Windows Common Controls 2 library.

2.1. To native .NET component (System.Windows.Forms)

Convert Microsoft's MSComCtl2 classes to System.Windows.Forms.

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

The following list shows which MSComCtl2 controls are mapped to .NET equivalents:

Class

Maps to

MSComCtl2.DTPicker

System.Windows.Forms.DateTimePicker

MSComCtl2.MonthView

System.Windows.Forms.MonthCalendar

MSComCtl2.FormatConstants

System.Windows.Forms.DateTimePickerFormat

MSComCtl2.MonthViewHitTestAreas

System.Windows.Forms.MonthCalendar.HitArea

MSComCtl2.DayConstants

System.Windows.Forms.Day

Original VB6 code:

Begin VB.Form Form1 
...
	Begin MSComCtl2.DTPicker DTPicker1 
		...
	End
	Begin MSComCtl2.MonthView MonthView1 
		...
	End
...

C# code:

partial class Form1
{
	...
	public  System.Windows.Forms.DateTimePicker DTPicker1;
	...
	public  System.Windows.Forms.MonthCalendar MonthView1;
	...
	private void  InitializeComponent()
	{
		...
		this.DTPicker1 = new System.Windows.Forms.DateTimePicker();
		...
		this.MonthView1 = new System.Windows.Forms.MonthCalendar();
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents DTPicker1 As System.Windows.Forms.DateTimePicker
	Public WithEvents MonthView1 As System.Windows.Forms.MonthCalendar
	...
	Private Sub InitializeComponent()
		...
		Me.DTPicker1 = New System.Windows.Forms.DateTimePicker
		...
		Me.MonthView1 = New System.Windows.Forms.MonthCalendar
		...

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:

Begin VB.Form Form1 
...
	Begin MSComCtl2.DTPicker DTPicker1 
		...
	End
	Begin MSComCtl2.MonthView MonthView1 
		...
	End
...

C# code:

partial class Form1
{
	...
	public AxMSComCtl2.AxDTPicker DTPicker1;
	public AxMSComCtl2.AxMonthView MonthView1;
	...
	private void  InitializeComponent()
	{
		...
		this.DTPicker1 = new AxMSComCtl2.AxDTPicker();
		this.MonthView1 = new AxMSComCtl2.AxMonthView();
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents DTPicker1 As AxMSComCtl2.AxDTPicker
	Public WithEvents MonthView1 As AxMSComCtl2.AxMonthView
	...
	Private Sub InitializeComponent()
		...
		Me.DTPicker1 = New AxMSComCtl2.AxDTPicker
		Me.MonthView1 = New AxMSComCtl2.AxMonthView
		...

3. MSComCtl

Microsoft Windows Common Controls Library

3.1. To native .NET component (System.Windows.Forms)

Convert Microsoft's MSComctlLib classes to System.Windows.Forms.

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

Class

Maps to

MSComctlLib.StatusBar

System.Windows.Forms.StatusStrip

MSComctlLib.ToolBar

System.Windows.Forms.ToolStrip

MSComctlLib.ImageList

System.Windows.Forms.ImageList

MSComctlLib.TabStrip

System.Windows.Forms.TabControl

MSComctlLib.TreeView

System.Windows.Forms.TreeView

MSComctlLib.ImageCombo

System.Windows.Forms.ComboBox

MSComctlLib.ListView

System.Windows.Forms.ListView

MSComctlLib.ProgressBar

System.Windows.Forms.ProgressBar

Original VB6 code:

Begin VB.Form Form1 
...
	Begin MSComctlLib.ImageCombo ImageCombo1 
		...
	End
	Begin MSComctlLib.Slider Slider1 
		...
	End
	Begin MSComctlLib.ImageList ImageList1 
		...
	End
	Begin MSComctlLib.ListView ListView1 
		...
	End
	Begin MSComctlLib.TreeView TreeView1 
		...
	End
	Begin MSComctlLib.ProgressBar ProgressBar1 
		...
	End
	Begin MSComctlLib.StatusBar StatusBar1 
		...
	End
	Begin MSComctlLib.TabStrip TabStrip1 
		...
	End
	Begin MSComctlLib.Toolbar Toolbar1 
		...
	End
...

C# code:

partial class Form1
{
	...
	public  System.Windows.Forms.MaskedTextBox MaskEdBox1;
	public  System.Windows.Forms.ComboBox ImageCombo1;
	public  System.Windows.Forms.TrackBar Slider1;
	public  System.Windows.Forms.ImageList ImageList1;
	public  System.Windows.Forms.ListView ListView1;
	public  System.Windows.Forms.TreeView TreeView1;
	public  System.Windows.Forms.ProgressBar ProgressBar1;
	private  System.Windows.Forms.ToolStripStatusLabel _StatusBar1_Panel1;
	public  System.Windows.Forms.StatusStrip StatusBar1;
	private  System.Windows.Forms.TabPage _TabStrip1_Tab1;
	public  System.Windows.Forms.TabControl.TabPageCollection TabStrip1_Tabs;
	public  System.Windows.Forms.TabControl TabStrip1;
	public  System.Windows.Forms.ToolStrip Toolbar1;
	...
	private void  InitializeComponent()
	{
		...
		this.ImageCombo1 = new System.Windows.Forms.ComboBox();
		this.Slider1 = new System.Windows.Forms.TrackBar();
		this.ImageList1 = new System.Windows.Forms.ImageList();
		this.ListView1 = new System.Windows.Forms.ListView();
		this.TreeView1 = new System.Windows.Forms.TreeView();
		this.ProgressBar1 = new System.Windows.Forms.ProgressBar();
		this.StatusBar1 = new System.Windows.Forms.StatusStrip();
		this._StatusBar1_Panel1 = new System.Windows.Forms.ToolStripStatusLabel();
		this.TabStrip1 = new System.Windows.Forms.TabControl();
		this.TabStrip1_Tabs = new System.Windows.Forms.TabControl.TabPageCollection(TabStrip1);
		this._TabStrip1_Tab1 = new System.Windows.Forms.TabPage();
		this.Toolbar1 = new System.Windows.Forms.ToolStrip();
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents ImageCombo1 As System.Windows.Forms.ImageComboBox
	Public WithEvents Slider1 As System.Windows.Forms.TrackBar
	Public WithEvents ImageList1 As System.Windows.Forms.ImageList
	Public WithEvents ListView1 As System.Windows.Forms.ListView
	Public WithEvents TreeView1 As System.Windows.Forms.TreeView
	Public WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar
	Private WithEvents _StatusBar1_Panel1 As System.Windows.Forms.ToolStripStatusLabel
	Public WithEvents StatusBar1 As System.Windows.Forms.StatusStrip
	Private WithEvents _TabStrip1_Tab1 As System.Windows.Forms.TabPage
	Public WithEvents TabStrip1_Tabs As System.Windows.Forms.TabControl.TabPageCollection
	Public WithEvents TabStrip1 As System.Windows.Forms.TabControl
	Public WithEvents Toolbar1 As System.Windows.Forms.ToolStrip
	...
	Private Sub InitializeComponent()
		...
		Me.ImageCombo1 = New System.Windows.Forms.ImageComboBox
		Me.Slider1 = New System.Windows.Forms.TrackBar
		Me.ImageList1 = New System.Windows.Forms.ImageList
		Me.ListView1 = New System.Windows.Forms.ListView
		Me.TreeView1 = New System.Windows.Forms.TreeView
		Me.ProgressBar1 = New System.Windows.Forms.ProgressBar
		Me.StatusBar1 = New System.Windows.Forms.StatusStrip
		Me._StatusBar1_Panel1 = New System.Windows.Forms.ToolStripStatusLabelo
		Me.TabStrip1 = New System.Windows.Forms.TabControl
		Me.TabStrip1_Tabs = New System.Windows.Forms.TabControl.TabPageCollection(TabStrip1)
		Me._TabStrip1_Tab1 = New System.Windows.Forms.TabPage
    		Me.Toolbar1 = New System.Windows.Forms.ToolStrip
		...

3.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 VB.Form Form1 
...
	Begin MSComctlLib.ImageCombo ImageCombo1 
		...
	End
	Begin MSComctlLib.Slider Slider1 
		...
	End
	Begin MSComctlLib.ImageList ImageList1 
		...
	End
	Begin MSComctlLib.ListView ListView1 
		...
	End
	Begin MSComctlLib.TreeView TreeView1 
		...
	End
	Begin MSComctlLib.ProgressBar ProgressBar1 
		...
	End
	Begin MSComctlLib.StatusBar StatusBar1 
		...
	End
	Begin MSComctlLib.TabStrip TabStrip1 
		...
	End
	Begin MSComctlLib.Toolbar Toolbar1 
		...
	End
...

C# code:

partial class Form1
{
	...
	public  AxMSComctlLib.AxImageCombo ImageCombo1;
	public  AxMSComctlLib.AxSlider Slider1;
	public  AxMSComctlLib.AxImageList ImageList1;
	public  AxMSComctlLib.AxListView ListView1;
  	public  AxMSComctlLib.AxTreeView TreeView1;
	public  AxMSComctlLib.AxProgressBar ProgressBar1;
	public  AxMSComctlLib.AxStatusBar StatusBar1;
	public  AxMSComctlLib.AxTabStrip TabStrip1;
  	public  AxMSComctlLib.AxToolbar Toolbar1;
	...
	private void  InitializeComponent()
   	{
		...
		this.ImageCombo1 = new AxMSComctlLib.AxImageCombo();
		this.Slider1 = new AxMSComctlLib.AxSlider();
		this.ImageList1 = new AxMSComctlLib.AxImageList();
		this.ListView1 = new AxMSComctlLib.AxListView();
		this.TreeView1 = new AxMSComctlLib.AxTreeView();
    		this.ProgressBar1 = new AxMSComctlLib.AxProgressBar();
		this.StatusBar1 = new AxMSComctlLib.AxStatusBar();
 		this.TabStrip1 = new AxMSComctlLib.AxTabStrip();
		this.Toolbar1 = new AxMSComctlLib.AxToolbar();
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents ImageCombo1 As AxMSComctlLib.AxImageCombo
	Public WithEvents Slider1 As AxMSComctlLib.AxSlider
	Public WithEvents ImageList1 As AxMSComctlLib.AxImageList
	Public WithEvents ListView1 As AxMSComctlLib.AxListView
	Public WithEvents TreeView1 As AxMSComctlLib.AxTreeView
	Public WithEvents ProgressBar1 As AxMSComctlLib.AxProgressBar
	Public WithEvents StatusBar1 As AxMSComctlLib.AxStatusBar
	Public WithEvents TabStrip1 As AxMSComctlLib.AxTabStrip
	Public WithEvents Toolbar1 As AxMSComctlLib.AxToolbar
	...
	Private Sub InitializeComponent()
		...
		Me.ImageCombo1 = New AxMSComctlLib.AxImageCombo
		Me.Slider1 = New AxMSComctlLib.AxSlider
		Me.ImageList1 = New AxMSComctlLib.AxImageList
		Me.ListView1 = New AxMSComctlLib.AxListView
		Me.TreeView1 = New AxMSComctlLib.AxTreeView
		Me.ProgressBar1 = New AxMSComctlLib.AxProgressBar
		Me.StatusBar1 = New AxMSComctlLib.AxStatusBar
		Me.TabStrip1 = New AxMSComctlLib.AxTabStrip
		Me.Toolbar1 = New AxMSComctlLib.AxToolbar
		...

4. MSComDlg

Microsoft Common Dialog Control Library

4.1. To native .NET component (System.Windows.Forms)

The MSComDlg CommonDialog control is used to display several types of dialogs: open file, save file, printer, color, and font dialogs. In .NET there are different types of dialog controls according to the necessity.

The Visual Basic Upgrade Companion converts the CommonDialog according to its use in the Visual Basic 6.0 source code to the following alternative controls: ColorDialog, FontDialog, OpenDialog, SaveDialog, and PrintDialog.

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

Original VB6 code:

Begin VB.Form Form1 
...
	Begin MSComDlg.CommonDialog CommonDialog_Save 
		...
	End
	Begin MSComDlg.CommonDialog CommonDialog_Open 
		...
	End
	Begin MSComDlg.CommonDialog CommonDialog_Printer 
		...
	End
	Begin MSComDlg.CommonDialog CommonDialog_Font 
		...
	End
	Begin MSComDlg.CommonDialog CommonDialog_Color 
		...
	End
	Begin MSComDlg.CommonDialog CommonDialog_Help 
		...
	End
...

C# code:

partial class Form1
{
	...
	public System.Windows.Forms.SaveFileDialog CommonDialog_SaveSave;
	public System.Windows.Forms.OpenFileDialog CommonDialog_OpenOpen;
	public System.Windows.Forms.PrintDialog CommonDialog_PrinterPrint;
	public System.Windows.Forms.FontDialog CommonDialog_FontFont;
	public System.Windows.Forms.ColorDialog CommonDialog_ColorColor;
	...
	private void  InitializeComponent()
	{
		...
		this.MaskEdBox1 = new System.Windows.Forms.MaskedTextBox();
    this.CommonDialog_SaveSave = new System.Windows.Forms.SaveFileDialog();
		this.CommonDialog_OpenOpen = new System.Windows.Forms.OpenFileDialog();
    this.CommonDialog_PrinterPrint = new System.Windows.Forms.PrintDialog();
    this.CommonDialog_PrinterPrint.PrinterSettings = new System.Drawing.Printing.PrinterSettings();
		this.CommonDialog_FontFont = new System.Windows.Forms.FontDialog();
 		this.CommonDialog_ColorColor = new System.Windows.Forms.ColorDialog();
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public CommonDialog_SaveSave As System.Windows.Forms.SaveFileDialog
	Public CommonDialog_OpenOpen As System.Windows.Forms.OpenFileDialog
	Public CommonDialog_PrinterPrint As System.Windows.Forms.PrintDialog
	Public CommonDialog_FontFont As System.Windows.Forms.FontDialog
	Public CommonDialog_ColorColor As System.Windows.Forms.ColorDialog
	...
	Private Sub InitializeComponent()
		...
		Me.CommonDialog_SaveSave = New System.Windows.Forms.SaveFileDialog
		Me.CommonDialog_OpenOpen = New System.Windows.Forms.OpenFileDialog
		Me.CommonDialog_PrinterPrint = New System.Windows.Forms.PrintDialog
		Me.CommonDialog_PrinterPrint.PrinterSettings = New System.Drawing.Printing.PrinterSettings
		Me.CommonDialog_FontFont = New System.Windows.Forms.FontDialog
		Me.CommonDialog_ColorColor = New System.Windows.Forms.ColorDialog
		...

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:

Begin VB.Form Form1 
...
	Begin MSComDlg.CommonDialog CommonDialog_Save 
		...
	End
	Begin MSComDlg.CommonDialog CommonDialog_Open 
		...
	End
	Begin MSComDlg.CommonDialog CommonDialog_Printer 
		...
	End
	Begin MSComDlg.CommonDialog CommonDialog_Font 
		...
	End
	Begin MSComDlg.CommonDialog CommonDialog_Color 
		...
	End
	Begin MSComDlg.CommonDialog CommonDialog_Help 
		...
	End
...

C# code:

partial class Form1
{
	...
	public  AxMSComDlg.AxCommonDialog CommonDialog_Save;
	public  AxMSComDlg.AxCommonDialog CommonDialog_Open;
	public  AxMSComDlg.AxCommonDialog CommonDialog_Printer;
	public  AxMSComDlg.AxCommonDialog CommonDialog_Font;
	public  AxMSComDlg.AxCommonDialog CommonDialog_Color;
	public  AxMSComDlg.AxCommonDialog CommonDialog_Help;
	...
	private void  InitializeComponent()
	{
		...
		this.CommonDialog_Save = new AxMSComDlg.AxCommonDialog();
		this.CommonDialog_Open = new AxMSComDlg.AxCommonDialog();
		this.CommonDialog_Printer = new AxMSComDlg.AxCommonDialog();
		this.CommonDialog_Font = new AxMSComDlg.AxCommonDialog();
		this.CommonDialog_Color = new AxMSComDlg.AxCommonDialog();
		this.CommonDialog_Help = new AxMSComDlg.AxCommonDialog();
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents CommonDialog_Save As AxMSComDlg.AxCommonDialog
	Public WithEvents CommonDialog_Open As AxMSComDlg.AxCommonDialog
	Public WithEvents CommonDialog_Printer As AxMSComDlg.AxCommonDialog
	Public WithEvents CommonDialog_Font As AxMSComDlg.AxCommonDialog
	Public WithEvents CommonDialog_Color As AxMSComDlg.AxCommonDialog
	Public WithEvents CommonDialog_Help As AxMSComDlg.AxCommonDialog
	...
	Private Sub InitializeComponent()
		...
		Me.CommonDialog_Save = New AxMSComDlg.AxCommonDialog
		Me.CommonDialog_Open = New AxMSComDlg.AxCommonDialog
		Me.CommonDialog_Printer = New AxMSComDlg.AxCommonDialog
		Me.CommonDialog_Font = New AxMSComDlg.AxCommonDialog
		Me.CommonDialog_Color = New AxMSComDlg.AxCommonDialog
		Me.CommonDialog_Help = New AxMSComDlg.AxCommonDialog
		...

5. DataCombo

5.1. To System.Windows.Forms.ComboBox

Convert Microsoft's MSDataList.DataCombo classes to System.Windows.Forms.

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

Class

Maps to

MSDataListLib.DataCombo.ListField

System.Windows.Forms.DisplayMember

MSDataListLib.DataCombo.BoundColumns

System.Windows.Forms.ValueMember

MSDataListLib.DataCombo.BoundText

System.Windows.Forms.SelectedValue

MSDataListLib.DataCombo.Height

System.Windows.Forms.Height

MSDataListLib.DataCombo.Width

System.Windows.Forms.Width

MSDataListLib.DataCombo.Text

System.Windows.Forms.Text

MSDataListLib.DataCombo.SelectedItem

System.Windows.Forms.SelectedIndex

MSDataListLib.DataCombo.SetFocus

System.Windows.Forms.Focus

Original VB6 code:

Private Sub Form_Load()
    Me.DataCombo1.Enabled = False
    Me.DataCombo1.Text = "Hello"
    Call Me.Refresh
End Sub

C# code:

private void Form_Load()
{
	this.DataCombo1.Enabled = false;
	this.DataCombo1.Text = "Hello";
	this.Refresh();
}

VB.NET code:

Private Sub Form_Load()
	Me.DataCombo1.Enabled = False
	Me.DataCombo1.Text = "Hello"
	Me.Refresh()
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:

Private Sub Form_Load()
    Me.DataCombo1.Enabled = False
    Me.DataCombo1.Text = "Hello"
    Call Me.Refresh
End Sub

C# code:

private void Form_Load()
{
	this.DataCombo1.Enabled = false;
	this.DataCombo1.CtlText = "Hello";
	this.Refresh();
}

VB.NET code:

Private Sub Form_Load()
	Me.DataCombo1.Enabled = False
	Me.DataCombo1.CtlText = "Hello"
	Me.Refresh()
End Sub

6. MSMask

Microsoft Mask Edit Control Library

6.1. To System.Windows.Forms.MaskedTextBox

Convert Microsoft's MSMask classes to System.Windows.Forms.

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

Class

Maps to

MSMask.MaskedBox

System.Windows.Forms.MaskedTextBox

MSMask.ClipModeConstants

System.Windows.Forms.MaskFormat

MSMask.BorderStyleConstants

System.Windows.Forms.BorderStyle

MSMask.MousePointerConstants

System.Windows.Forms.Cursor

Original VB6 code:

Begin VB.Form Form1 
...
Begin MSMask.MaskEdBox MaskEdBox1 
      Height          =   495
      Left            =   1200
      TabIndex        =   0
      Top             =   240
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   873
      _Version        =   393216
      PromptChar      =   "_"
End
...

C# code:

partial class Form1
{
	...
	public  System.Windows.Forms.MaskedTextBox MaskEdBox1;
	...
	private void  InitializeComponent()
	{
		...
		this.MaskEdBox1 = new System.Windows.Forms.MaskedTextBox();
		...
		this.MaskEdBox1.AllowPromptAsInput = false;
		this.MaskEdBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.MaskEdBox1.Location = new System.Drawing.Point(80, 16);
		this.MaskEdBox1.Name = "MaskEdBox1";
		this.MaskEdBox1.PromptChar = '_';
		this.MaskEdBox1.Size = new System.Drawing.Size(137, 33);
		this.MaskEdBox1.TabIndex = 0;
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents MaskEdBox1 As System.Windows.Forms.MaskedTextBox
	...
	Private Sub InitializeComponent()
		...
		Me. MaskEdBox1= New System.Windows.Forms.MaskedTextBox
		...
		Me.MaskEdBox1.AllowPromptAsInput = False
		Me.MaskEdBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)
		Me.MaskEdBox1.Location = New System.Drawing.Point(80, 16)
		Me.MaskEdBox1.Name = "MaskEdBox1"
		Me.MaskEdBox1.PromptChar = "_"c
		Me.MaskEdBox1.Size = New System.Drawing.Size(137, 33)
		Me.MaskEdBox1.TabIndex = 0
		...

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:

Begin VB.Form Form1 
...
Begin MSMask.MaskEdBox MaskEdBox1 
      Height          =   495
      Left            =   1200
      TabIndex        =   0
      Top             =   240
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   873
      _Version        =   393216
      PromptChar      =   "_"
End
...

C# code:

partial class Form1
{
	...
	public  AxMSMask.AxMaskEdBox MaskEdBox1;
	...
	private void  InitializeComponent()
	{
		...
		this.MaskEdBox1= new AxMSMask.AxMaskEdBox();
		...
		this.MaskEdBox1.Location = new System.Drawing.Point(80, 16);
		this.MaskEdBox1.Name = "MaskEdBox1";
		this.MaskEdBox1.OcxState = (System.Windows.Forms.AxHost.State) resources.GetObject("MaskEdBox1.OcxState");
		this.MaskEdBox1.Size = new System.Drawing.Size(137, 33);
		this.MaskEdBox1.TabIndex = 0;
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents MaskEdBox1 As AxMSMask.AxMaskEdBox
	...
	Private Sub InitializeComponent()
		...
		Me.MaskEdBox1 = New AxMSMask.AxMaskEdBox
		...
		Me.MaskEdBox1.Location = New System.Drawing.Point(80, 16)
		Me.MaskEdBox1.Name = "MaskEdBox1"
		Me.MaskEdBox1.OcxState = CType(resources.GetObject("MaskEdBox1.OcxState"), System.Windows.Forms.AxHost.State)
		Me.MaskEdBox1.Size = New System.Drawing.Size(137, 33)
		Me.MaskEdBox1.TabIndex = 0
		...

7. MSMQ

Microsoft Message Queue Object Library

7.1. To System.Messaging Library

Convert MSMQ (Microsoft Message Queue Object Library) to System.Messaging .NET library.

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

This upgrade option is only available for .NET framework and is not available for .NET 6 or higher.

ClassMaps to

MSMQ.MSMQQueueInfo

System.Messaging.MessageQueue

MSMQ.MSMQQueue

System.Messaging.MessageQueue

MSMQ.MSMQMessage

System.Messaging.Message

MSMQ.MSMQQueueInfos

Array of System.Messaging.MessageQueue

MSMQ.MSMQTransactionDispenser

System.Messaging.MessageQueueTransaction

MSMQ.MSMQTransactionDispenser

System.Messaging.MessageQueueTransaction

MSMQ.MSMQCoordinatedTransactionDispenser

System.Messaging.MessageQueueTransaction

Original VB6 Code:

Dim qInfo As MSMQ.MSMQQueueInfo
Dim q As MSMQ.MSMQQueue
Dim msg As MSMQ.MSMQMessage
Dim qInfos As MSMQ.MSMQQueueInfos
Dim query As MSMQ.MSMQQuery
Dim dispenser As MSMQ.MSMQTransactionDispenser
Dim transaction As MSMQ.MSMQTransaction
Private Sub Command1_Click()
    Set q = New MSMQ.MSMQQueue
    Set query = New MSMQ.MSMQQuery
    Set dispenser = New MSMQ.MSMQTransactionDispenser
    Set transaction = New MSMQ.MSMQTransaction
    Set qInfo = New MSMQ.MSMQQueueInfo
    qInfo.PathName = ".\Private$\testqueue6"
    Set q = qInfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
    ' Create a new message
    Set msg = New MSMQ.MSMQMessage
    Set transaction = dispenser.BeginTransaction
    msg.Body = "Hello, MSMQ were set with the properties ,'Delivery', 'Priority', 'Journal'!"
    msg.Delivery = MQMSG_DELIVERY_EXPRESS
    msg.Priority = MQ_MAX_PRIORITY
    msg.Journal = 1
    msg.Send q, transaction
    transaction.Commit
    MsgBox "Message sent successfully", vbInformation
    q.Close
    Set q = Nothing
    ' Get Public Queues
    Set qInfos = query.LookupQueue(ServiceTypeGuid:="{00000000-0000-0000-0000-000000000004}")
End Sub

C# Code:

partial class Form1: System.Windows.Forms.Form
{
	...
	System.Messaging.MessageQueue qInfo = null;
	System.Messaging.MessageQueue q = null;
	System.Messaging.Message msg = null;
	System.Messaging.MessageQueue[] qInfos = null;
	//UPGRADE_ISSUE: (2068) MSMQ.MSMQQuery object was not upgraded. More Information: https://docs.mobilize.net/vbuc/ewis#2068
	UpgradeStubs.MSMQ_MSMQQuery query = null;
	System.Messaging.MessageQueueTransaction dispenser = null;
	System.Messaging.MessageQueueTransaction transaction = null;
	private void Command1_Click(Object eventSender, EventArgs eventArgs)
	{
		q = new System.Messaging.MessageQueue();
		//UPGRADE_ISSUE: (2068) MSMQ.MSMQQuery object was not upgraded. More Information: https://docs.mobilize.net/vbuc/ewis#2068
		query = new UpgradeStubs.MSMQ_MSMQQuery();
		dispenser = new System.Messaging.MessageQueueTransaction();
		transaction = new System.Messaging.MessageQueueTransaction();
		qInfo = new System.Messaging.MessageQueue();
		qInfo.Path = ".\\Private$\\testqueue6";
		//UPGRADE_WARNING: (2065) MSMQ.MSMQQueueInfo method qInfo.Open has a new behavior. More Information: https://docs.mobilize.net/vbuc/ewis#2065
		q = (System.Messaging.MessageQueue) (qInfo = new System.Messaging.MessageQueue(qInfo.Path, false, false, System.Messaging.QueueAccessMode.Send));
		// Create a new message
		msg = new System.Messaging.Message();
		dispenser.Begin();
		transaction = (System.Messaging.MessageQueueTransaction) dispenser;
		msg.Body = "Hello, MSMQ were set with the properties ,'Delivery', 'Priority', 'Journal'!";
		msg.Recoverable = false;
		msg.Priority = System.Messaging.MessagePriority.Highest;
		msg.UseJournalQueue = true;
		//UPGRADE_WARNING: (2065) MSMQ.MSMQMessage method msg.Send has a new behavior. More Information: https://docs.mobilize.net/vbuc/ewis#2065
		q.Send(msg);
		transaction.Commit();
		MessageBox.Show("Message sent successfully", AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()), MessageBoxButtons.OK, MessageBoxIcon.Information);
		q.Close();
		q = null;
		// Get Public Queues
		qInfos = (System.Messaging.MessageQueue[]) System.Messaging.MessageQueue.GetPublicQueuesByCategory(new Guid("{00000000-0000-0000-0000-000000000004}"));
	}
	...
}

VB.NET Code:

Partial Class Form1 
	Inherits System.Windows.Forms.Form
	...
	Dim qInfo As System.Messaging.MessageQueue
	Dim q As System.Messaging.MessageQueue
	Dim msg As System.Messaging.Message
	Dim qInfos() As System.Messaging.MessageQueue
	'UPGRADE_ISSUE: (2068) MSMQ.MSMQQuery object was not upgraded. More Information: https://docs.mobilize.net/vbuc/ewis#2068
	Dim query As MSMQ_DocumentationSupport.UpgradeStubs.MSMQ_MSMQQuery
	Dim dispenser As System.Messaging.MessageQueueTransaction
	Dim transaction As System.Messaging.MessageQueueTransaction
	Private Sub Command1_Click(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles Command1.Click
		q = New System.Messaging.MessageQueue()
		'UPGRADE_ISSUE: (2068) MSMQ.MSMQQuery object was not upgraded. More Information: https://docs.mobilize.net/vbuc/ewis#2068
		query = New MSMQ_DocumentationSupport.UpgradeStubs.MSMQ_MSMQQuery()
		dispenser = New System.Messaging.MessageQueueTransaction()
		transaction = New System.Messaging.MessageQueueTransaction()
		qInfo = New System.Messaging.MessageQueue()
		qInfo.Path = ".\Private$\testqueue6"
		qInfo = New System.Messaging.MessageQueue(qInfo.Path, False, False, System.Messaging.QueueAccessMode.Send)
		'UPGRADE_WARNING: (2065) MSMQ.MSMQQueueInfo method qInfo.Open has a new behavior. More Information: https://docs.mobilize.net/vbuc/ewis#2065
		q = qInfo
		' Create a new message
		msg = New System.Messaging.Message()
		dispenser.Begin()
		transaction = dispenser
		msg.Body = "Hello, MSMQ were set with the properties ,'Delivery', 'Priority', 'Journal'!"
		msg.Recoverable = False
		msg.Priority = System.Messaging.MessagePriority.Highest
		msg.UseJournalQueue = True
		'UPGRADE_WARNING: (2065) MSMQ.MSMQMessage method msg.Send has a new behavior. More Information: https://docs.mobilize.net/vbuc/ewis#2065
		q.Send(msg)
		transaction.Commit()
		MessageBox.Show("Message sent successfully", My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Information)
		q.Close()
		q = Nothing
		' Get Public Queues
		qInfos = System.Messaging.MessageQueue.GetPublicQueuesByCategory(New Guid("{00000000-0000-0000-0000-000000000004}"))
	End Sub
End Class

7.2. To COM Interop

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

Original VB6 Code:

Dim qInfo As MSMQ.MSMQQueueInfo
Dim q As MSMQ.MSMQQueue
Dim msg As MSMQ.MSMQMessage
Dim qInfos As MSMQ.MSMQQueueInfos
Dim query As MSMQ.MSMQQuery
Dim dispenser As MSMQ.MSMQTransactionDispenser
Dim transaction As MSMQ.MSMQTransaction
Private Sub Command1_Click()
    Set q = New MSMQ.MSMQQueue
    Set query = New MSMQ.MSMQQuery
    Set dispenser = New MSMQ.MSMQTransactionDispenser
    Set transaction = New MSMQ.MSMQTransaction
    Set qInfo = New MSMQ.MSMQQueueInfo
    qInfo.PathName = ".\Private$\testqueue6"
    Set q = qInfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
    ' Create a new message
    Set msg = New MSMQ.MSMQMessage
    Set transaction = dispenser.BeginTransaction
    msg.Body = "Hello, MSMQ were set with the properties ,'Delivery', 'Priority', 'Journal'!"
    msg.Delivery = MQMSG_DELIVERY_EXPRESS
    msg.Priority = MQ_MAX_PRIORITY
    msg.Journal = 1
    msg.Send q, transaction
    transaction.Commit
    MsgBox "Message sent successfully", vbInformation
    q.Close
    Set q = Nothing
    ' Get Public Queues
    Set qInfos = query.LookupQueue(ServiceTypeGuid:="{00000000-0000-0000-0000-000000000004}")
End Sub

C# Code:

internal partial class Form1: System.Windows.Forms.Form
{
	...
	MSMQ.MSMQQueueInfo qInfo = null;
	MSMQ.MSMQQueue q = null;
	MSMQ.MSMQMessage msg = null;
	MSMQ.MSMQQueueInfos qInfos = null;
	MSMQ.MSMQQuery query = null;
	MSMQ.MSMQTransactionDispenser dispenser = null;
	MSMQ.MSMQTransaction transaction = null;
	private void Command1_Click(Object eventSender, EventArgs eventArgs)
	{
		q = new MSMQ.MSMQQueue();
		query = new MSMQ.MSMQQuery();
		dispenser = new MSMQ.MSMQTransactionDispenser();
		transaction = new MSMQ.MSMQTransaction();
		qInfo = new MSMQ.MSMQQueueInfo();
		qInfo.PathName = ".\\Private$\\testqueue6";
		q = (MSMQ.MSMQQueue) qInfo.Open((int) MSMQ.MQACCESS.MQ_SEND_ACCESS, (int) MSMQ.MQSHARE.MQ_DENY_NONE);
		// Create a new message
		msg = new MSMQ.MSMQMessage();
		transaction = (MSMQ.MSMQTransaction) dispenser.BeginTransaction();
		msg.Body = "Hello, MSMQ were set with the properties ,'Delivery', 'Priority', 'Journal'!";
		msg.Delivery = (int) MSMQ.MQMSGDELIVERY.MQMSG_DELIVERY_EXPRESS;
		msg.Priority = (int) MSMQ.MQPRIORITY.MQ_MAX_PRIORITY;
		msg.Journal = 1;
		object tempRefParam = transaction;
		msg.Send(q, ref tempRefParam);
		transaction = (MSMQ.MSMQTransaction) tempRefParam;
		object tempRefParam2 = Type.Missing;
		object tempRefParam3 = Type.Missing;
		object tempRefParam4 = Type.Missing;
		transaction.Commit(ref tempRefParam2, ref tempRefParam3, ref tempRefParam4);
		MessageBox.Show("Message sent successfully", AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()), MessageBoxButtons.OK, MessageBoxIcon.Information);
		q.Close();
		q = null;
		// Get Public Queues
		object tempRefParam5 = null;
		object tempRefParam6 = "{00000000-0000-0000-0000-000000000004}";
		object tempRefParam7 = Type.Missing;
		object tempRefParam8 = Type.Missing;
		object tempRefParam9 = Type.Missing;
		object tempRefParam10 = Type.Missing;
		object tempRefParam11 = Type.Missing;
		object tempRefParam12 = Type.Missing;
		object tempRefParam13 = Type.Missing;
		object tempRefParam14 = Type.Missing;
		object tempRefParam15 = Type.Missing;
		qInfos = (MSMQ.MSMQQueueInfos) query.LookupQueue(ref tempRefParam5, ref tempRefParam6, ref tempRefParam7, ref tempRefParam8, ref tempRefParam9, ref tempRefParam10, ref tempRefParam11, ref tempRefParam12, ref tempRefParam13, ref tempRefParam14, ref tempRefParam15);
	}
	...
}

VB.NET Code:

Partial Friend Class Form1
	Inherits System.Windows.Forms.Form
	...
	Dim qInfo As MSMQ.MSMQQueueInfo
	Dim q As MSMQ.MSMQQueue
	Dim msg As MSMQ.MSMQMessage
	Dim qInfos As MSMQ.MSMQQueueInfos
	Dim query As MSMQ.MSMQQuery
	Dim dispenser As MSMQ.MSMQTransactionDispenser
	Dim transaction As MSMQ.MSMQTransaction
	Private Sub Command1_Click(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles Command1.Click
		q = New MSMQ.MSMQQueue()
		query = New MSMQ.MSMQQuery()
		dispenser = New MSMQ.MSMQTransactionDispenser()
		transaction = New MSMQ.MSMQTransaction()
		qInfo = New MSMQ.MSMQQueueInfo()
		qInfo.PathName = ".\Private$\testqueue6"
		q = qInfo.Open(MSMQ.MQACCESS.MQ_SEND_ACCESS, MSMQ.MQSHARE.MQ_DENY_NONE)
		' Create a new message
		msg = New MSMQ.MSMQMessage()
		transaction = dispenser.BeginTransaction()
		msg.Body = "Hello, MSMQ were set with the properties ,'Delivery', 'Priority', 'Journal'!"
		msg.Delivery = MSMQ.MQMSGDELIVERY.MQMSG_DELIVERY_EXPRESS
		msg.Priority = MSMQ.MQPRIORITY.MQ_MAX_PRIORITY
		msg.Journal = 1
		msg.Send(q, transaction)
		transaction.Commit()
		MessageBox.Show("Message sent successfully", My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Information)
		q.Close()
		q = Nothing
		' Get Public Queues
		qInfos = query.LookupQueue(Nothing, "{00000000-0000-0000-0000-000000000004}")
	End Sub
End Class

8. MSWLess

Microsoft Windowless Controls Library

8.1. To System.Windows.Forms controls

Convert Microsoft's MSWLess to System.Windows.Forms .NET component controls.

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

Class

Maps to

MSWLess.WLCheck

System.Windows.Forms.CheckBox

MSWLess.WLCombo

System.Windows.Forms.ComboBox

MSWLess.WLText

System.Windows.Forms.TextBox

MSWLess.AlignmentConstants

System.Drawing.ContentAlignment

MSWLess.CheckValueConstants

System.Windows.Forms.CheckState

MSWLess.StyleComboConstants

System.Windows.Forms.ComboBoxStyle

MSWLess.ScrollBarsConstants

System.Windows.Forms.ScrollBars

Original VB6 code:

Begin VB.Form Form1 
...
	Begin MSWLess.WLText WLText1 
		Height          =   375
		Left            =   0
		TabIndex        =   2
		Top             =   1080
		Width           =   2055
		_ExtentX        =   3625
		_ExtentY        =   661
		_Version        =   393216
		Text            =   "WLText1"
		ForeColor       =   -2147483640
		BackColor       =   -2147483643
		BorderStyle     =   1
		Appearance      =   1
	End
	Begin MSWLess.WLCombo WLCombo1 
		Height          =   315
		Left            =   0
		TabIndex        =   1
		Top             =   720
		Width           =   2055
		_ExtentX        =   3625
		_ExtentY        =   556
		_Version        =   393216
		ListCount       =   9404
		Text            =   "WLCombo1"
 		ForeColor       =   -2147483640
		BackColor       =   -2147483643
		Appearance      =   1
		List            =   "Form1.frx":0000
	End
	Begin MSWLess.WLCheck WLCheck1 
		Height          =   495
		Left            =   120
		TabIndex        =   0
		Top             =   120
		Width           =   1815
		_ExtentX        =   3201
      		_ExtentY        =   873
 		_Version        =   393216
 		Caption         =   "WLCheck1"
		Appearance      =   1
	End
	...
...

C# code:

partial class Form1
{
	...
	public  System.Windows.Forms.TextBox WLText1;
	public  System.Windows.Forms.ComboBox WLCombo1;
	public  System.Windows.Forms.CheckBox WLCheck1;
	...
	private void  InitializeComponent()
	{
		...
		this.WLText1 = new System.Windows.Forms.TextBox();
		this.WLCombo1 = new System.Windows.Forms.ComboBox();
		this.WLCheck1 = new System.Windows.Forms.CheckBox();
		// 
		//WLText1
		// 
		this.WLText1.BackColor = System.Drawing.SystemColors.Window;
		this.WLText1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.WLText1.ForeColor = System.Drawing.SystemColors.WindowText;
		this.WLText1.Location = new System.Drawing.Point(0, 72);
		this.WLText1.Name = "WLText1";
		this.WLText1.Size = new System.Drawing.Size(137, 25);
		this.WLText1.TabIndex = 2;
		this.WLText1.Text = "WLText1";
		// 
		//WLCombo1
		// 
		this.WLCombo1.BackColor = System.Drawing.SystemColors.Window;
		this.WLCombo1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.WLCombo1.ForeColor = System.Drawing.SystemColors.WindowText;
		this.WLCombo1.Location = new System.Drawing.Point(0, 48);
		this.WLCombo1.Name = "WLCombo1";
		this.WLCombo1.Size = new System.Drawing.Size(137, 21);
		this.WLCombo1.TabIndex = 1;
		this.WLCombo1.Text = "WLCombo1";
		// 
		//WLCheck1
		// 
		this.WLCheck1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.WLCheck1.Location = new System.Drawing.Point(8, 8);
		this.WLCheck1.Name = "WLCheck1";
		this.WLCheck1.Size = new System.Drawing.Size(121, 33);
		this.WLCheck1.TabIndex = 0;
		this.WLCheck1.Text = "WLCheck1";
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents WLText1 As System.Windows.Forms.TextBox
	Public WithEvents WLCombo1 As System.Windows.Forms.ComboBox
	Public WithEvents WLCheck1 As System.Windows.Forms.CheckBox
	...
	Private Sub InitializeComponent()
		...
		Me.WLText1 = New System.Windows.Forms.TextBox
		Me.WLCombo1 = New System.Windows.Forms.ComboBox
		Me.WLCheck1 = New System.Windows.Forms.CheckBox
		'' 
		'WLText1
		' 
		Me.WLText1.BackColor = System.Drawing.SystemColors.Window
		Me.WLText1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)
		Me.WLText1.ForeColor = System.Drawing.SystemColors.WindowText
		Me.WLText1.Location = New System.Drawing.Point(0, 72)
		Me.WLText1.Name = "WLText1"
		Me.WLText1.Size = New System.Drawing.Size(137, 25)
		Me.WLText1.TabIndex = 2
		Me.WLText1.Text = "WLText1"
		'' 
		' WLCombo1
		' 
		Me.WLCombo1.BackColor = System.Drawing.SystemColors.Window
		Me.WLCombo1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)
		Me.WLCombo1.ForeColor = System.Drawing.SystemColors.WindowText
		Me.WLCombo1.Location = New System.Drawing.Point(0, 48)
		Me.WLCombo1.Name = "WLCombo1"
		Me.WLCombo1.Size = New System.Drawing.Size(137, 21)
		Me.WLCombo1.TabIndex = 1
		Me.WLCombo1.Text = "WLCombo1"
		''
		'WLCheck1
		' 
		Me.WLCheck1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)
		Me.WLCheck1.Location = New System.Drawing.Point(8, 8)
		Me.WLCheck1.Name = "WLCheck1"
		Me.WLCheck1.Size = New System.Drawing.Size(121, 33)
 		Me.WLCheck1.TabIndex = 0
		Me.WLCheck1.Text = "WLCheck1"
		...

8.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 VB.Form Form1 
...
	Begin MSWLess.WLText WLText1 
		Height          =   375
		Left            =   0
		TabIndex        =   2
		Top             =   1080
		Width           =   2055
		_ExtentX        =   3625
		_ExtentY        =   661
		_Version        =   393216
		Text            =   "WLText1"
		ForeColor       =   -2147483640
		BackColor       =   -2147483643
		BorderStyle     =   1
		Appearance      =   1
	End
	Begin MSWLess.WLCombo WLCombo1 
		Height          =   315
		Left            =   0
		TabIndex        =   1
		Top             =   720
		Width           =   2055
		_ExtentX        =   3625
		_ExtentY        =   556
		_Version        =   393216
		ListCount       =   9404
		Text            =   "WLCombo1"
 		ForeColor       =   -2147483640
		BackColor       =   -2147483643
		Appearance      =   1
		List            =   "Form1.frx":0000
	End
	Begin MSWLess.WLCheck WLCheck1 
		Height          =   495
		Left            =   120
		TabIndex        =   0
		Top             =   120
		Width           =   1815
		_ExtentX        =   3201
      		_ExtentY        =   873
 		_Version        =   393216
 		Caption         =   "WLCheck1"
		Appearance      =   1
	End
	...
...

C# code:

partial class Form1
{
	...
	public  AxMSWLess.AxWLText WLText1;
	public  AxMSWLess.AxWLCombo WLCombo1;
	public  AxMSWLess.AxWLCheck WLCheck1;
	...
	private void  InitializeComponent()
	{
		...
		this.WLText1 = new AxMSWLess.AxWLText();
		this.WLCombo1 = new AxMSWLess.AxWLCombo();
        		this.WLCheck1 = new AxMSWLess.AxWLCheck();
		// 
		//WLText1
		// 
		this.WLText1.Location = new System.Drawing.Point(0, 72);
		this.WLText1.Name = "WLText1";
 		this.WLText1.OcxState = (System.Windows.Forms.AxHost.State) resources.GetObject("WLText1.OcxState");
		this.WLText1.Size = new System.Drawing.Size(137, 25);
		this.WLText1.TabIndex = 2;
         	//
		//WLCombo1
		// 
		this.WLCombo1.Location = new System.Drawing.Point(0, 48);
		this.WLCombo1.Name = "WLCombo1";
		this.WLCombo1.OcxState = (System.Windows.Forms.AxHost.State) resources.GetObject("WLCombo1.OcxState");
		this.WLCombo1.Size = new System.Drawing.Size(137, 21);
		this.WLCombo1.TabIndex = 1;
		// 
		//WLCheck1
         	// 
 		this.WLCheck1.Location = new System.Drawing.Point(8, 8);
		this.WLCheck1.Name = "WLCheck1";
		this.WLCheck1.OcxState = (System.Windows.Forms.AxHost.State) resources.GetObject("WLCheck1.OcxState");
		this.WLCheck1.Size = new System.Drawing.Size(121, 33);
		this.WLCheck1.TabIndex = 0;
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents WLText1 As AxMSWLess.AxWLText
	Public WithEvents WLCombo1 As AxMSWLess.AxWLCombo
   	Public WithEvents WLCheck1 As AxMSWLess.AxWLCheck
	...
   	Private Sub InitializeComponent()
		...
		Me.WLText1 = New AxMSWLess.AxWLText
		Me.WLCombo1 = New AxMSWLess.AxWLCombo
		Me.WLCheck1 = New AxMSWLess.AxWLCheck
		''
		'WLText1
		' 
		Me.WLText1.Location = New System.Drawing.Point(0, 72)
		Me.WLText1.Name = "WLText1"
		Me.WLText1.OcxState = CType(resources.GetObject("WLText1.OcxState"), System.Windows.Forms.AxHost.State)
		Me.WLText1.Size = New System.Drawing.Size(137, 25)
		Me.WLText1.TabIndex = 2
		'' 
		'WLCombo1
		' 
		Me.WLCombo1.Location = New System.Drawing.Point(0, 48)
    		Me.WLCombo1.Name = "WLCombo1"
		Me.WLCombo1.OcxState = CType(resources.GetObject("WLCombo1.OcxState"), System.Windows.Forms.AxHost.State)
		Me.WLCombo1.Size = New System.Drawing.Size(137, 21)
		Me.WLCombo1.TabIndex = 1
		'' 
		'WLCheck1
		' 
		Me.WLCheck1.Location = New System.Drawing.Point(8, 8)
		Me.WLCheck1.Name = "WLCheck1"
		Me.WLCheck1.OcxState = CType(resources.GetObject("WLCheck1.OcxState"), System.Windows.Forms.AxHost.State)
		Me.WLCheck1.Size = New System.Drawing.Size(121, 33)
		Me.WLCheck1.TabIndex = 0
		...

9. MSXML2

Microsoft XML2 Library

9.1.To System.Xml classes

Convert Microsoft's MSXML2 library to System.Xml .NET classes.

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

Class

Maps to

MSXML2.DOMDocument

System.Xml.XmlDocument

MSXML2.DOMNodeType

System.Xml.XmlNodeType

MSXML2.IXMLDOMAttribute

System.Xml.XmlAttribute

MSXML2.IXMLDOMCDATASection

System.Xml.XmlCDataSection

MSXML2.IXMLDOMDocument

System.Xml.XmlDocument

MSXML2.IXMLDOMElement

System.Xml.XmlElement

MSXML2.IXMLDOMNamedNodeMap

System.Xml.XmlNamedNodeMap

MSXML2.IXMLDOMNode

System.Xml.XmlNode

MSXML2.IXMLDOMNodeList

System.Xml.XmlNodeList

MSXML2.IXMLDOMParseError

System.Exception

MSXML2.IXMLDOMText

System.Xml.XmlCharacterData

MSXML2.tagDOMNodeType

System.Xml.XmlNodeType

MSXML2.IXMLDOMCharacterData

System.Xml.XmlCharacterData

MSXML2.IXMLDOMDocumentFragment

System.Xml.XmlDocumentFragment

MSXML2.IXMLDOMComment

System.Xml.XmlComment

MSXML2.IXMLDOMEntity

System.Xml.XmlEntity

MSXML2.IXMLDOMEntityReference

System.Xml.XmlEntityReference

MSXML2.IXMLDOMImplementation

System.Xml.XmlImplementation

MSXML2.IXMLDOMNotation

System.Xml.XmlNotation

MSXML2.IXMLDOMProcessingInstruction

System.Xml.XmlProcessingInstruction

MSXML2.IXMLDOMDocumentType

System.Xml.XmlDocumentType

MSXML2.FreeThreadedDOMDocument

System.Xml.XmlDocument

MSXML2.FreeThreadedDOMDocument40

System.Xml.XmlDocument

MSXML2.DOMDocument40

System.Xml.XmlDocument

Original VB6 code:

Private Sub foo()

Dim doc As MSXML2.DOMDocument
Dim node As MSXML2.IXMLDOMNode
Dim newnode As MSXML2.IXMLDOMNode
Dim newclonednode As MSXML2.IXMLDOMNode

Set newnode = doc.appendChild(node)
Set newclonednode = doc.cloneNode(True)
newnode.appendChild newclonednode

Dim n As MSXML2.IXMLDOMNode
Dim theNodeList As MSXML2.IXMLDOMNodeList

Set theNodeList = doc.selectNodes("Norway")

For Each n In theNodeList
	n.Attributes(0).nodeValue = "Norway"
Next n

End Sub

C# code:

partial class Form1
{
	...
	private void  foo()
	{       
		XmlDocument doc = null;
		XmlNode node = null;
		XmlNode newnode = doc.AppendChild(node);
		XmlNode newclonednode = doc.CloneNode(true);
		newnode.AppendChild(newclonednode);
		XmlNodeList theNodeList = doc.SelectNodes("Norway");               
		foreach (XmlNode n in theNodeList)
		{
			n.Attributes.Item(0).Value = "Norway";
		}
	}
}

VB.NET code:

Partial Class Form1
	...
	Private Sub foo()      
		Dim doc As XmlDocument
		Dim node As XmlNode
		Dim newnode As XmlNode = doc.AppendChild(node)
		Dim newclonednode As XmlNode = doc.CloneNode(True)
		newnode.AppendChild(newclonednode)
		Dim theNodeList As XmlNodeList = doc.SelectNodes("Norway")
		For Each n As XmlNode In theNodeList
			n.Attributes.Item(0).Value = "Norway"
		Next n      
	End Sub

9.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 foo()

Dim doc As MSXML2.DOMDocument
Dim node As MSXML2.IXMLDOMNode
Dim newnode As MSXML2.IXMLDOMNode
Dim newclonednode As MSXML2.IXMLDOMNode

Set newnode = doc.appendChild(node)
Set newclonednode = doc.cloneNode(True)
newnode.appendChild newclonednode

Dim n As MSXML2.IXMLDOMNode
Dim theNodeList As MSXML2.IXMLDOMNodeList

Set theNodeList = doc.selectNodes("Norway")

For Each n In theNodeList
	n.Attributes(0).nodeValue = "Norway"
Next n

End Sub

C# code:

partial class Form1
{
	...
	private void  foo()
	{               
		MSXML2.DOMDocument doc = null;
		MSXML2.IXMLDOMNode node = null;               
		MSXML2.IXMLDOMNode newnode = doc.appendChild(node);
		MSXML2.IXMLDOMNode newclonednode = doc.cloneNode(true);
		newnode.appendChild(newclonednode);               
		MSXML2.IXMLDOMNodeList theNodeList = doc.selectNodes("Norway");
		foreach (MSXML2.IXMLDOMNode n in theNodeList)
		{
			//UPGRADE_WARNING: (1037) Couldn't resolve default property of object n.Attributes().nodeValue.
			n.attributes[0].nodeValue = "Norway";
		}
	}
}

VB.NET code:

Partial Class Form1
	...
	Private Sub foo()      
		Dim doc As MSXML2.DOMDocument
		Dim node As MSXML2.IXMLDOMNode
		Dim newnode As MSXML2.IXMLDOMNode = doc.appendChild(node)
		Dim newclonednode As MSXML2.IXMLDOMNode = doc.cloneNode(True)
		newnode.appendChild(newclonednode)
    Dim theNodeList As MSXML2.IXMLDOMNodeList = doc.selectNodes("Norway")
		For Each n As MSXML2.IXMLDOMNode In theNodeList
			'UPGRADE_WARNING: (1037) Couldnt resolve default property of object n.Attributes().nodeValue.'
			n.attributes(0).nodeValue = "Norway"
		Next n      
	End Sub
	...

10. RichTextBox

10.1. To System.Windows.Forms.RichTextBox

Convert RichTextBox to a .NET component control.

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

Class

Maps to

RichTextLib.RichTextBox

System.Windows.Forms.RichTextBox

RichTextLib.AppearanceConstants

System.Windows.Forms.BorderStyle

RichTextLib.BorderStyleConstants

System.Windows.Forms.BorderStyle

RichTextLib.ScrollBarsConstants

System.Windows.Forms.RichTextBoxScrollBars

RichTextLib.FindConstants

System.Windows.Forms.RichTextBoxFinds

RichTextLib.LoadSaveConstants

System.Windows.Forms.RichTextBoxStreamType

RichTextLib.SelAlignmentConstants

System.Windows.Forms.HorizontalAlignment

RichTextLib.MousePointerConstants

System.Windows.Forms.Cursor

Original VB6 code:

Begin VB.Form Form1 
...
	Begin RichTextLib.RichTextBox RichTextBox1 
		Height          =   615
		Left            =   120
		TabIndex        =   0
		Top             =   120
		Width           =   2175
		_ExtentX        =   3836
		_ExtentY        =   1085
		_Version        =   393217
		TextRTF         =   $"Form1.frx":0000
	End
...

C# code:

partial class Form1
{
	...
	public  System.Windows.Forms.RichTextBox RichTextBox1;
	...
	private void  InitializeComponent()
	{
		...
		this.RichTextBox1 = new System.Windows.Forms.RichTextBox();
		this.RichTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
		this.RichTextBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
		this.RichTextBox1.Location = new System.Drawing.Point(8, 8);
		this.RichTextBox1.Name = "RichTextBox1";
		this.RichTextBox1.Rtf = resources.GetString("RichTextBox1.TextRTF");
		this.RichTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
		this.RichTextBox1.Size = new System.Drawing.Size(145, 41);
		this.RichTextBox1.TabIndex = 0;
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox
	...
	Private Sub InitializeComponent()
		...
		Me.RichTextBox1 = New System.Windows.Forms.RichTextBox
		Me.RichTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
		Me.RichTextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)
		Me.RichTextBox1.Location = New System.Drawing.Point(8, 8)
		Me.RichTextBox1.Name = "RichTextBox1"
		Me.RichTextBox1.Rtf = resources.GetString("RichTextBox1.TextRTF")
		Me.RichTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None
		Me.RichTextBox1.Size = New System.Drawing.Size(145, 41)
		Me.RichTextBox1.TabIndex = 0
		...

10.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 VB.Form Form1 
...
	Begin RichTextLib.RichTextBox RichTextBox1 
		Height          =   615
		Left            =   120
		TabIndex        =   0
		Top             =   120
		Width           =   2175
		_ExtentX        =   3836
		_ExtentY        =   1085
		_Version        =   393217
		TextRTF         =   $"Form1.frx":0000
	End
...

C# code:

partial class Form1
{
	...
	public  AxRichTextLib.AxRichTextBox RichTextBox1;
	...
	private void  InitializeComponent()
	{
		...
		this.RichTextBox1 = new AxRichTextLib.AxRichTextBox();
		this.RichTextBox1.Location = new System.Drawing.Point(8, 8);
		this.RichTextBox1.Name = "RichTextBox1";
		this.RichTextBox1.OcxState = (System.Windows.Forms.AxHost.State) resources.GetObject("RichTextBox1.OcxState");
		this.RichTextBox1.ScrollBars = RichTextLib.ScrollBarsConstants.rtfNone;
		this.RichTextBox1.Size = new System.Drawing.Size(145, 41);
		this.RichTextBox1.TabIndex = 0;
		...
	}
}

VB.NET code:

Partial Class Form1
   ...
   Public WithEvents RichTextBox1 As AxRichTextLib.AxRichTextBox
   ...
   Private Sub InitializeComponent()
      ...
      Me.RichTextBox1 = New AxRichTextLib.AxRichTextBox
      Me.RichTextBox1.Location = New System.Drawing.Point(8, 8)
      Me.RichTextBox1.Name = "RichTextBox1"
      Me.RichTextBox1.OcxState = CType(resources.GetObject("RichTextBox1.OcxState"), System.Windows.Forms.AxHost.State)
      Me.RichTextBox1.ScrollBars = RichTextLib.ScrollBarsConstants.rtfNone
      Me.RichTextBox1.Size = New System.Drawing.Size(145, 41)
      Me.RichTextBox1.TabIndex = 0
      ...

11. Scripting

11.1. To .NET classes

This feature maps the "Scripting.Dictionary" class to a .NET "OrderedDictionary". A dictionary is an object that stores key/item pairs. Each item is associated with a unique key which is usually an integer or a string. For full information about the vb6 class you can visit: https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/dictionary-object

This option converts the "Scripting.Dictionary" class to a .NET "OrderedDictionary". Members are also mapped to OrderedDictionary members.

General Description:

An OrderedDictionary is a dictionary (hash table) that preserves the order (as VB6 does) in which the keys are inserted. A regular dictionary does not track the insertion order.

Original VB6 code:

Public Sub Foo(dict As Scripting.Dictionary)    
	Call dict.Add("A", 1): Call dict.Add("B", 2): Call dict.Add("C", 3)
	If dict.Exists("C") Then
		MsgBox dict.item("C")
	End If
	For Each value In dict.keys
		MsgBox value 'prints A B C'
	Next
	For Each value In dict.Items
		MsgBox value 'prints 1 2 3'
	Next
End Sub

C# code:

public static void Foo(OrderedDictionary dict)
{
	dict.Add("A", 1);  dict.Add("B", 2);  dict.Add("C", 3);
	if (dict.Contains("C"))
	{
		MessageBox.Show(Convert.ToString(dict["C"]));
	}
	foreach (object value in dict.Keys)
	{
		MessageBox.Show(Convert.ToString(value)); //prints A B C
	}
	foreach (object value in dict.Values)
	{
		MessageBox.Show(Convert.ToString(value)); //prints 1 2 3
	}
}

VB.NET code:

Public Sub Foo(ByVal dict As OrderedDictionary)
	dict.Add("A", 1) : dict.Add("B", 2) : dict.Add("C", 3)
	If dict.Contains("C") Then
		MessageBox.Show(CStr(dict.Item("C")))
	End If
	For Each value As Object In dict.Keys
		MessageBox.Show(CStr(value), My.Application.Info.Title) 'prints A B C'
	Next value
	For Each value As Object In dict.Values
		MessageBox.Show(CStr(value), My.Application.Info.Title) 'prints 1 2 3'
	Next value
End Sub

11.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:

Public Sub Foo(dict As Scripting.Dictionary)    
	Call dict.Add("A", 1): Call dict.Add("B", 2): Call dict.Add("C", 3)
	If dict.Exists("C") Then
		MsgBox dict.item("C")
	End If
	For Each value In dict.keys
		MsgBox value 'prints A B C'
	Next
	For Each value In dict.Items
		MsgBox value 'prints 1 2 3'
	Next
End Sub

C# code:

public static void Foo(Scripting.Dictionary dict)
{
	object tempRefParam = "A"; object tempRefParam2 = 1;
	dict.Add(ref tempRefParam, ref tempRefParam2);
	object tempRefParam3 = "B"; object tempRefParam4 = 2;
	dict.Add(ref tempRefParam3, ref tempRefParam4);
	object tempRefParam5 = "C"; object tempRefParam6 = 3;
	dict.Add(ref tempRefParam5, ref tempRefParam6);
	object tempRefParam7 = "C";
	if (dict.Exists(ref tempRefParam7))
	{
		object tempRefParam8 = "C";
		MessageBox.Show(Convert.ToString(dict.get_Item(ref tempRefParam8)));
	}
	foreach (object value in (System.Collections.IEnumerable) dict.Keys())
	{
		MessageBox.Show(Convert.ToString(value)); //prints A B C
	}
	foreach (object value in (System.Collections.IEnumerable) dict.Items())
	{
		MessageBox.Show(Convert.ToString(value)); //prints 1 2 3
	}
}

VB.NET code:

Public Sub Foo(ByVal dict As Scripting.Dictionary)
	dict.Add("A", 1) : dict.Add("B", 2) : dict.Add("C", 3)
	If dict.Exists("C") Then
		MessageBox.Show(CStr(dict.Item("C")))
	End If
	For Each value As Object In dict.Keys()
		MessageBox.Show(CStr(value)) 'prints A B C'
	Next value
	For Each value As Object In dict.Items()
		MessageBox.Show(CStr(value)) 'prints 1 2 3'
	Next value
End Sub

12. SHDocVw

Microsoft Internet Controls Library

12.1. To System.Windows.Forms.WebBrowser

Convert the controls and classes contained in the shdocvw.dll to .NET Native classes.

General Description:

The Microsoft Internet Controls (SHDocVw) is a set of controls and classes that enable building web/DHTML applications in Visual Basic 6. WebBrowser and InternetExplorer are controls of this library.

Class

Maps to

WebBrowser

System.Windows.Forms.WebBrowser

SecureLockIconConstants

System.Windows.Forms.WebBrowserEncryptionLevel

tagREADYSTATE

System.Windows.Forms.WebBrowserReadyState

InternetExplorer

System.Windows.Forms.WebBrowser

Original VB6 code:

Private Sub Command1_Click() 'Go Back Button'
	WebBrowser1.GoBack() 'Go Back'
End Sub

Private Sub Command2_Click() 'Go Forward Button'
	WebBrowser1.GoForward() 'Go Forward'
End Sub

Private Sub Form_Load()
	WebBrowser1.Navigate("www.artinsoft.com")
End Sub

Private Sub WebBrowser1_CommandStateChange(ByVal Command As Long, ByVal Enable As Boolean)
	Select Case Command
		Case 1 'Forward'
			Command2.Enabled = True
		Case 2 'Back'
			Command1.Enabled = True
	End Select
End Sub

C# code:

private void Command1_Click(Object eventSender, EventArgs eventArgs) //Go Back Button
{
	WebBrowser1.GoBack(); //Go Back
}

private void Command2_Click(Object eventSender, EventArgs eventArgs) //Go Forward Button
{
	WebBrowser1.GoForward(); //Go Forward
}

//UPGRADE_WARNING: (2080) Form_Load event was upgraded to Form_Load event and has a new behavior.
private void Form1_Load(Object eventSender, EventArgs eventArgs)
{
WebBrowser1.Navigate("www.artinsoft.com");
}

//UPGRADE_WARNING: (2050) SHDocVw.WebBrowser Event WebBrowser1.CommandStateChange was not upgraded.
private void WebBrowser1_CommandStateChange(int Command, bool Enable)
{
switch(Command)
	{
		case 1 :  //Forward 
			Command2.Enabled = true; 
			break;
case 2 :  //Back 
			Command1.Enabled = true; 
			break;
		}
	}
}

VB.NET code:

Private Sub Command1_Click(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles Command1.Click 'Go Back Button'
	WebBrowser1.GoBack() 'Go Back'
End Sub

Private Sub Command2_Click(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles Command2.Click 'Go Forward Button'
	WebBrowser1.GoForward() 'Go Forward'
End Sub

'UPGRADE_WARNING: (2080) Form_Load event was upgraded to Form_Load event and has a new behavior.'
Private Sub Form1_Load(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles MyBase.Load
	WebBrowser1.Navigate("www.artinsoft.com")
End Sub

'UPGRADE_WARNING: (2050) SHDocVw.WebBrowser Event WebBrowser1.CommandStateChange was not upgraded.'
Private Sub WebBrowser1_CommandStateChange(ByVal Command As Integer, ByVal Enable As Boolean)
	Select Case Command
		Case 1 'Forward'
			Command2.Enabled = True
		Case 2 'Back'
			Command1.Enabled = True
	End Select
End Sub

12.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 Command1_Click() 'Go Back Button'
	WebBrowser1.GoBack() 'Go Back'
End Sub

Private Sub Command2_Click() 'Go Forward Button'
	WebBrowser1.GoForward() 'Go Forward'
End Sub

Private Sub Form_Load()
	WebBrowser1.Navigate("www.artinsoft.com")
End Sub

Private Sub WebBrowser1_CommandStateChange(ByVal Command As Long, ByVal Enable As Boolean)
	Select Case Command
		Case 1 'Forward'
			Command2.Enabled = True
		Case 2 'Back'
			Command1.Enabled = True
	End Select
End Sub

C# code:

private void Command1_Click(Object eventSender, EventArgs eventArgs) //Go Back Button
{
	WebBrowser1.GoBack(); //Go Back
}

private void Command2_Click(Object eventSender, EventArgs eventArgs) //Go Forward Button
{ 
	WebBrowser1.GoForward(); //Go Forward
}

//UPGRADE_WARNING: (2080) Form_Load event was upgraded to Form_Load event and has a new behavior.
private void Form1_Load(Object eventSender, EventArgs eventArgs)
{
	WebBrowser1.Navigate(new URI("www.artinsoft.com"));
}

//UPGRADE_WARNING: (2050) SHDocVw.WebBrowser Event WebBrowser1.CommandStateChange was not upgraded.
private void WebBrowser1_CommandStateChange(int Command, bool Enable)
{
	switch(Command)
	{
		case 1 :  //Forward 
			Command2.Enabled = true; 
			break;
		case 2 :  //Back 
			Command1.Enabled = true; 
			break;
	}
}

VB.NET code:

Private Sub Command1_Click(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles Command1.Click 'Go Back Button'
	WebBrowser1.GoBack() 'Go Back'
End Sub

Private Sub Command2_Click(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles Command2.Click 'Go Forward Button'
	WebBrowser1.GoForward() 'Go Forward'
End Sub

'UPGRADE_WARNING: (2080) Form_Load event was upgraded to Form_Load event and has a new behavior.'
Private Sub Form1_Load(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles MyBase.Load
	WebBrowser1.Navigate(New URI("www.artinsoft.com"))
End Sub

'UPGRADE_WARNING: (2050) SHDocVw.WebBrowser Event WebBrowser1.CommandStateChange was not upgraded.'
Private Sub WebBrowser1_CommandStateChange(ByVal Command As Integer, ByVal Enable As Boolean)
	Select Case Command
		Case 1 'Forward'
			Command2.Enabled = True
		Case 2 'Back'
			Command1.Enabled = True
	End Select
End Sub

13. Shell32

13.1. To System.Diagnostics Methods

Convert the API calls of Shell32 to their equivalents in System.Diagnostics.

Operation

Purpose

Edit

Launches an editor and opens the file for editing.

Explore

Explores the folder listed in the file parameter.

Find

Starts the find utility at the specified directory.

Open

Opens the file using the appropriate default application. It can also executes processes and applications.

Print

Prints the file.

Original VB6 code:

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
	(ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
	ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

ShellExecute 0, "open", "C:\file.ext", Empty, Empty, 1

C# code:

System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.UseShellExecute = true;
startInfo.CreateNoWindow = true;
startInfo.Verb = "open";
startInfo.FileName = "C:\\file.ext";
startInfo.Arguments = "";
startInfo.WorkingDirectory = "";
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;

System.Diagnostics.Process.Start(startInfo);

VB.NET code:

Dim startInfo As New System.Diagnostics.ProcessStartInfo()
startInfo.UseShellExecute = True
startInfo.CreateNoWindow = True
startInfo.Verb = "open"
startInfo.FileName = "C:\file.ext"
startInfo.Arguments = ""
startInfo.WorkingDirectory = ""
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal

System.Diagnostics.Process.Start(startInfo)

13.2. To PInvoke

This option will port the API call into the resulting application via a support project.

General Description:

This optional feature will take the API declaration and create an interoperability code wrapper to make it visible from the managed code. This means the call’s functionality will remain the same since it will use the same API but the resulting application will depend on the API binary file.

Original VB6 code:

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
	(ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
	ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

ShellExecute 0, "open", "C:\file.ext", Empty, Empty, 1

C# code:

string tempRefParam = "open";
string tempRefParam2 = "C:\\file.ext";
string tempRefParam3 = "";
string tempRefParam4 = "";

ProjectSupport.PInvoke.SafeNative.shell32.ShellExecute(0, ref tempRefParam, ref tempRefParam2, ref tempRefParam3, ref tempRefParam4, 1);

VB.NET code:

ProjectSupport.SafeNative.shell32.ShellExecute(0, "open", "C:\file.ext", "", "", 1)

14. VB Script Regex

The VB Script RegExp class compares strings with specific text patterns known as regular expressions.

14.1. To System.Text.RegularExpressions and helpers

This optional feature allows the VBUC to convert VB Script RegExp to System.Text.RegularExpressions library and helpers.

This option converts VB Script RegExp by using helper classes, achieving very high automation levels and a similar VB6 behavior.

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

ClassMaps to

VBScript_RegExp_55.Regexp

UpgradeHelpers.Utils.ScriptRegexHelper

VBScript_RegExp_55.MatchCollection

System.Text.RegularExpressions.MatchCollection

VBScript_RegExp_55.Match

System.Text.RegularExpressions.Match

Original VB6 Code:

Private Sub cmdSearch_Click()
    Dim strInput As String
    Dim regex As RegExp
    Dim matches As MatchCollection
    Dim match As match
    
    strInput = txtInput.text
    
    'Create Regex object
    Set regex = New RegExp
    regex.Global = True
    regex.IgnoreCase = True
    regex.Pattern = "(\w+)"
    
    'Search all coincidences
    Set matches = regex.Execute(strInput)
    
    'Show coincidences found
    Dim i As Integer
    For Each match In matches
        MsgBox "Result " & i + 1 & ": " & match.Value
        i = i + 1
    Next match
End Sub

C# code:

private void cmdSearch_Click(Object eventSender, EventArgs eventArgs)
{
	Match match = null;

	string strInput = txtInput.Text;

	//Create Regex object
	ScriptRegexHelper regex = new ScriptRegexHelper();
	//UPGRADE_ISSUE: (2064) VBScript_RegExp_55.RegExp property regex.Global was not upgraded. More Information: https://docs.mobilize.net/vbuc/ewis#2064
	regex.setGlobal(true);
	regex.IgnoreCase = true;
	regex.Pattern = "(\\w+)";

	//Search all coincidences
	MatchCollection matches = (MatchCollection) regex.Execute(strInput);

	//Show coincidences found
	int i = 0;
	foreach (Match matchIterator in matches)
	{
		match = matchIterator;
		MessageBox.Show($"Result {(i + 1).ToString()}: {match.Value}", AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()));
		i++;
		//match
		match = default(Match);
	}
}

VB.NET code:

Private Sub cmdSearch_Click(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles cmdSearch.Click
	Dim match As Match

	Dim strInput As String = txtInput.Text

	'Create Regex object
	Dim regex As New ScriptRegexHelper()
	'UPGRADE_ISSUE: (2064) VBScript_RegExp_55.RegExp property regex.Global was not upgraded. More Information: https://docs.mobilize.net/vbuc/ewis#2064
	regex.setGlobal(True)
	regex.IgnoreCase = True
	regex.Pattern = "(\w+)"

	'Search all coincidences
	Dim matches As MatchCollection = regex.Execute(strInput)

	'Show coincidences found
	Dim i As Integer
	For	Each matchIterator As Match In matches
		match = matchIterator
		MessageBox.Show("Result " & i + 1 & ": " & match.Value, My.Application.Info.Title)
		i += 1
		'match
		match = CType(Nothing, Match)
	Next matchIterator
End Sub

14.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 cmdSearch_Click()
    Dim strInput As String
    Dim regex As RegExp
    Dim matches As MatchCollection
    Dim match As match
    
    strInput = txtInput.text
    
    'Create Regex object
    Set regex = New RegExp
    regex.Global = True
    regex.IgnoreCase = True
    regex.Pattern = "(\w+)"
    
    'Search all coincidences
    Set matches = regex.Execute(strInput)
    
    'Show coincidences found
    Dim i As Integer
    For Each match In matches
        MsgBox "Result " & i + 1 & ": " & match.Value
        i = i + 1
    Next match
End Sub

C# code:

private void cmdSearch_Click(Object eventSender, EventArgs eventArgs)
{
	VBScript_RegExp_55.Match match = null;

	string strInput = txtInput.Text;

	//Create Regex object
	VBScript_RegExp_55.RegExp regex = new VBScript_RegExp_55.RegExp();
	regex.Global = true;
	regex.IgnoreCase = true;
	regex.Pattern = "(\\w+)";

	//Search all coincidences
	VBScript_RegExp_55.MatchCollection matches = (VBScript_RegExp_55.MatchCollection) regex.Execute(strInput);

	//Show coincidences found
	int i = 0;
	foreach (VBScript_RegExp_55.Match matchIterator in matches)
	{
		match = matchIterator;
		MessageBox.Show($"Result {(i + 1).ToString()}: {match.Value}", AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()));
		i++;
		//match
		match = default(VBScript_RegExp_55.Match);
	}
}

VB.NET Code:

Private Sub cmdSearch_Click(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles cmdSearch.Click
	Dim match As VBScript_RegExp_55.Match

	Dim strInput As String = txtInput.Text

	'Create Regex object
	Dim regex As New VBScript_RegExp_55.RegExp()
	regex.Global = True
	regex.IgnoreCase = True
	regex.Pattern = "(\w+)"

	'Search all coincidences
	Dim matches As VBScript_RegExp_55.MatchCollection = regex.Execute(strInput)

	'Show coincidences found
	Dim i As Integer
	For	Each matchIterator As VBScript_RegExp_55.Match In matches
		match = matchIterator
		MessageBox.Show("Result " & i + 1 & ": " & match.Value, My.Application.Info.Title)
		i += 1
		'match
		match = CType(Nothing, VBScript_RegExp_55.Match)
	Next matchIterator
End Sub

Last updated