How to Create a Form with no Title Bar in VB for Windows

Last reviewed: June 21, 1995
Article ID: Q83349
The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, versions 2.0 and 3.0
- Microsoft Visual Basic programming system for Windows, version 1.0

SUMMARY

To create a Microsoft Visual Basic for Windows form with a border but with no title bar, the Caption property of a form must be set to a zero-length string; the BorderStyle property must be set to Fixed Single (1), Sizable (2) or Fixed Double; and the ControlBox, MaxButton and MinButton properties must be set to False (0). If any text (including spaces) exists for the Caption property or if the ControlBox, MaxButton, or MinButton property is set to True, a title bar will appear on the form.

NOTE: Setting the BorderStyle property to None (0) will always result in a form with no title bar.

MORE INFORMATION

Even with the ControlBox, MaxButton, and MinButton properties of a form set to False (0) and the BorderStyle set to Fixed Single (1), Sizable (2) or Fixed Double (3), the form will still have a title bar unless the Caption property is set to null. Setting the Caption to blanks will leave a title bar with no title.

Steps to Reproduce Behavior

  1. Run Visual Basic for Windows, or from the File menu, choose New Project (press ALT, F, N) if Visual Basic for Windows is already running. Form1 is created by default.

  2. From the Properties bar, set the ControlBox, MaxButton, and MinButton properties to False.

  3. Set the Caption property to at least one space.

  4. Press the F5 key to run the program. The form will have a title bar without a title.

  5. Press CTRL+BREAK to return to design mode.

  6. Set the Caption property to a zero-length string (that is, delete all characters including spaces).

  7. Press the F5 key to run the program. There should be no title bar on the form.

You can also have a form with no title bar by setting the BorderStyle property to None (0).


Additional reference words: 1.00 2.00 3.00
KBCategory: kbgraphic kbprg
KBSubcategory: APrgGrap


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.