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.





Label control

Alignment property

The Alignment property has been renamed as TextAlign. The VB6 control always aligns text to the top and you can only decide whether it’s left justified, right justified, or centered. The VB.NET control also allows to defined vertical alignment.



Appearance and BorderStyle properties

The VB6 Appearance property has been dropped and its effect has been integrated into the VB.NET BorderStyle property, according the following rule: if BorderStyle is equal to 0-None under VB6 then the control has no border and the Appearance property is ignored; if BorderStyle is equal to 1-FixedSingle and Appearance is equal to 0-Flat under VB6, then the VB.NET BorderStyle is set to 1-Flat; if BorderStyle is equal to 1-FixedSingle and Appearance is equal to 1-ThreeD under VB6, then the VB.NET BorderStyle is set to 2-Fixed3D.

VB Migration Partner supports all the combinations of Appearance and BorderStyle properties.



AutoSize property

The default value for the AutoSize property is False under VB6; the value of the AutoSize property of a VB.NET Label control dropped on a form is True.



BackStyle property

VB.NET Label controls don’t support the BackStyle property and there is no simple way to implement it. The background portion of a VB.NET Label control is always opaque.

If the Label control has a nonempty caption, VB Migration Partner simulates the BackStyle property by setting the BackColor property to the background color of the container controls when the BackStyle property is set to 0-Transparent. If the Label control has an empty caption, VB Migration Partner improves the simulation by making the control truly transparent while it continues to receive mouse events.



Caption property

The Caption property is renamed as Text.

There is also an additional minor difference: under VB6, any carriage-return (ASCII 13) character splits text on two distinct lines; under VB.NET you need a full CR-LF pair (that is, ASCII 13 + ASCII 10) to split text on multiple lines. VB Migration Partner correctly accounts for this detail.



Change event

The Change event has been renamed as TextChanged.



WordWrap property

VB.NET Label controls don’t support the WordWrap property, because they always wrap long lines of text and there is no way to avoid it. However, you can simulate the VB6 behavior by changing the Height property, so that the wrapped lines aren’t visible.

The Label control in VB Migration Partner’s support library exposes the WordWrap control, but it always returns True. Any attempt to assign a different value is ignored (or throws an exception if the VB6Config.ThrowOnUnsupportedMembers property is True.)