VB Migration Partner

KNOWLEDGE BASE - Forms and controls

Previous | Index | Next 

[INFO] The .NET Toolbar control can’t contain standard controls

The VB6 Toolbar control is capable to contain regular control, such as TextBox and ComboBox control; this capability is missing in the .NET ToolStrip control and is therefore missing in VB Migration Partner’s VB6Toolbar control, which is just a wrapper for the ToolStrip control. (The .NET Toolbar control can only contain controls that inherit from the System.Windows.Forms.ToolStripItem base class, e.g. ToolStripButton or ToolStripComboBox controls.)

VB Migration Partner recognizes that the Toolbar can’t work as a container in VB.NET and correctly moves the toolbar’s child controls to the form’s surface, so that they appear in front of the toolbar itself. These actions make the converted VB.NET form look very similar to the original VB6 form.

However, if the form contains two or more toolbars, typically the controls that used to be contained in the VB6 toolbar are misplaced on the VB.NET form and overlap a different toolbar control, possibly hiding other controls. If this is the case, you must set the position of these child controls manually, from inside the Form_Load event handler.

For example, suppose that you are converting a form that has three toolbars on it. Toolbar1 is the top-most toolbar; Toolbar2 is located below Toolbar1 and contains a child control named Combo1; Toolbar3 is located below Toolbar2 and contains a child control named Text1. The best way to ensure that the positions of the two child controls are migrated correctly is adding a bunch of InsertStatement pragmas in the original VB6 code:

        Private Sub Form_Load()
             '##InsertStatement Combo1.Move(Combo1.Left + Toolbar2.Left, _
                 Combo1.Top + Toolbar2.Top)
             '##InsertStatement Text1.Move(Text1.Left + Toolbar3.Left, _
                 text1.Top + Toolbar3.Top)
             ' original code for the Form_Load event here ...
         End Sub

Needless to say, this should be regarded as a temporary solution. After converting the application to VB.NET you should replace child controls with equivalent controls that inherit from the ToolStripItem class. For example, the Combo1 control should be replaced by a ToolStripComboBox control and the Text1 control should be replaced by a ToolStripTextBox control. After such replacements, the code in the Form_Load event should be deleted.

Previous | Index | Next 

Follow Francesco Balena on VB6 migration’s group on


Read Microsoft Corp’s official case study of a VB6 conversion using VB Migration Partner.

Code Architects and its partners offers remote and onsite migration services.

More details

Subscribe to our free newsletter for useful VB6 migration tips and techniques.


To learn more about your VB6 applications, run VB6 Analyzer on your source code and send us the generated text file. You will receive a detailed report about your VB6 applications and how VB Migration Partner can help you to quickly and effectively migrate it to .NET.

Get free advice

A fully-working, time-limited Trial Edition of VB Migration Partner allows you to test it against your actual code

Get the Trial

The price of VB Migration Partner depends on the size of the VB6 application, the type of license, and other factors

Request a quote

Migrating a VB6 application in 10 easy steps

Comparing VB Migration Partner with Upgrade Wizard

Migration tools: Feature Comparison Table

All whitepapers