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.





CommandButton control

Appearance property

The Appearance property has been renamed as FlatStyle.

VB Migration Partner still supports the Appearance property, so that migrated code works as expected even if the control is accessed in late-bound mode.



Cancel and Default properties

The VB.NET Button control doesn’t support the Cancel or Default properties. Instead, you select which the default and cancel buttons on a form are by setting the form’s AcceptButton and CancelButton properties. Therefore, the following VB6 code:

        btnCancel.Cancel = True
        btnOK.Default = True

can be converted to VB.NET as follows:

        Me.CancelButton = btnCancel
        Me.AcceptButton = btnOK

Both the Upgrade Wizard and VB Migration Partner correctly migrate forms containing default and cancel buttons. However, only VB Migration Partner supports these properties when assigned in late-bound mode or when the button is located inside a usercontrol.



Click event

VB.NET exposes both a Click and a MouseClick event. You should always use the Click event in migrated applications, because the MouseClick event doesn’t fire if the button is operated with the Space key.



DownPicture and DisabledPicture properties

These properties have no VB.NET counterpart. You can achieve the same effect in VB.NET by monitoring the mouse activity on the button (for DownPicture) and changes to the Enabled property (for DisabledPicture).

VB Migration Partner fully supports these properties and correctly display buttons in down or disable state.



MaskColor and UseMaskColor properties

These properties have no VB.NET counterpart and can’t be easily implemented.

VB Migration Partner supports both properties. If UseMaskColor is equal to True, the button displays an image where all pixels whose color is equal to MaskColor are rendered as transparent pixels.



Picture and Style properties

The VB6 Picture property maps to the VB.NET Image property, but the Style property has no VB.NET counterpart. (In VB6 the Picture property is used only if Style=1-vbButtonGraphical.) Therefore, you should assign the .NET Image property only if you really mean to display an image.

In addition to displaying an image, the VB6 Style property affects the position of the button’s caption: in standard buttons the caption is centered vertically, whereas in graphical buttons it is near to the bottom border. You can reach the same effect by assigning the VB.NET TextAlign property.

VB Migration Partner fully supports all the possible combinations of these two properties.



Value property

In VB6 you can programmatically set the Value property of a CommandButton control to indirectly fire the control’s Click event. You reach the same effect under VB.NET by invoking the PerformClick method.

VB Migration Partner fully supports the Value property.