This section describes the differences between VB6 and .NET controls and the problems you can find in migrating VB6 applications with user-interface. The differences that are common to most controls are described in the Controls (general) section.

For a list of differences between VB6 and VB.NET language, see here.

Unless otherwise stated, VB Migration Partner fully supports all the Visual Basic 6 features mentioned in this page. It is worth noticing that names of properties and methods are preserved, which ensures that those even late-bound references work correctly after the migration to VB.NET. For more information, please read the manual and the knowledge base section.

Menu control

Top-level menus, drop-down menus, and separators

VB.NET uses three different objects to render the VB6 Menu object.

  • Top-level menus are translated as MenuStrip objects; there is only one MenuStrip object in each form, whose child controls are drop-down menus.
  • Drop-down menus are translated as ToolStripMenuItem objects.
  • Separator bars are translated as ToolStripSeparator objects. (A VB6 separator is a plain menu object whose Caption property is set to the “-“ character.)

VB Migration Partner handles this important difference internally and generates VB.NET code that behaves like the original VB6 code in virtually all cases.

Caption property

The Caption property maps to the Text property under .NET, but there is an important difference. If you assign a “-“ (dash) character to the Caption property, you actually transform the menu element into a menu separator under VB6, even at runtime. Nothing similar happens under VB.NET.

VB Migration Partner can correctly handle these assignments and correctly transforms a menu element into a separator (or vice versa), depending on the value being assigned to the Caption property.

Click event

VB.NET menus support the Click event; however, in VB6 the Click event of dropdown menu fires immediately after the menu becomes visible, whereas .NET fires the Click event before the dropdown menus becomes visible. For this reason, event handlers generated by the Upgrade Wizard might be executed at the wrong time and cause runtime errors or bogus results. If you need to handle the Click event of dropdown menus you should use the DropDownOpened event instead.

VB Migration Partner is aware of this difference and fires the Click event at the right time even for dropdown menus.

NegotiatePosition property

The NegotiatePosition property isn’t supported by .NET menus.

VB Migration Partner supports this property, so that the VB.NET code always compiles correctly. However, this property doesn’t affect the menu’s appearance or behavior.

Shortcut property

The VB6 Shortcut property maps to the ShortcutKeys property under VB.NET.

Visible property

The .NET MenuStrip, ToolStripMenuItem, and ToolStripSeparator objects all support the Visible property. However, there are two important differences. First, when a top-level menu becomes visible all the controls on the form are shifted down to make room for the menu; likewise, when a top-level menu becomes invisible, all controls on the form are shifted up. Second, the Visible property of ToolStripMenuItem and ToolStripSeparator objects return False both if you set it to False or if you set the parent menu’s Visible property to False.

VB Migration Partner automatically accounts for all these minor differences, so that the generated VB.NET is guaranteed to work like the original VB6 code.