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. MSWLess

Microsoft Windowless Controls Library

7.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"
...

7.2. To COM Interop

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

Original VB6 code:

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