VB Migration Partner

KNOWLEDGE BASE - Forms and controls

Previous | Index | Next 

[PRB] The VB6 form has border, but the migrated VB.NET form hasn’t

VB6 and VB.NET slightly differ in the way they manage borderless forms. In VB6, a form whose BorderStyle property is set to 0-None, can still have a border. More precisely, if the BorderStyle property is set to 0-None you you have to account for the following special cases:

  1. if the form has no menu, then the form has neither a title bar nor a border, regardless of the value of ControlBox and Caption properties
  2. if the form has a menu (either visible or not), its ControlBox property is True or the Caption property is a nonempty string, then the form has a border and displays a title bar (as if BorderStyle were set to 1-FixedSingle)
  3. if the form has a menu, its ControlBox property is False, and the Caption property is set to an empty string, then the form has a 1-pixel black border around it, and displays the menu bar if the menu is visible

While speaking of borderless forms, you should account for another special case:

  1. regardless of the value of the BorderStyle property, if a form has its ControlBox property set to False and its Caption property set to an empty string, then the form displays a 1-pixel black border around it

By contrast, VB.NET forms whose FormBorderStyle property is set to 0-None have no border, regardless of their current value of the ControlBox and Text properties. Likewise, VB.NET forms whose FormBorderStyle property is different from 0-None always have a border and a title bar, even if the title bar displays neither a caption nor buttons.

VB Migration Partner correctly mimics VB6 behaviors in the first two cases, but doesn’t perfectly handle the remaining cases because no value for FormBorderStyle property can display a 1-pixel border. In cases (C) and (D), VB Migration Partner display a form with no border at all.

If necessary, in these cases you can achieve a behavior similar (but not identical) to VB6’s by setting the form’s FormBorderStyle property to FixedSingle – for example by means of a WriteProperty pragma -, but be aware that the thicker border reduces the size of the form’s client area, thus you might need to compensate by making the form slightly larger. There is no approach that is valid for all circumstances and you should make a decision based on the application’s requirements and expected behavior.

There is one more little difference in how the two languages handle borderless forms: a VB6 borderless form can’t be closed by pressing the Alt+F4 key combination, whereas a VB.NET borderless form can.

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