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:
- 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
- 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)
- 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:
- 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.