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);