BorderStyle Property
TOC
Collapse the table of content
Expand the table of content

Visual Basic Reference

Visual Studio 6.0

BorderStyle Property

See Also    Example    Applies To

Returns or sets the border style for an object. For the Form object and the TextBox control, read-only at run time.

Syntax

object.BorderStyle = [value]

The BorderStyle property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
value A value or constant that determines the border style, as described in Settings.

Settings

The BorderStyle property settings for a Form object are:

Constant Setting Description
vbBSNone 0 None (no border or border-related elements).
vbFixedSingle 1 Fixed Single. Can include Control-menu box, title bar, Maximize button, and Minimize button. Resizable only using Maximize and Minimize buttons.
vbSizable 2 (Default) Sizable. Resizable using any of the optional border elements listed for setting 1.
vbFixedDouble 3 Fixed Dialog. Can include Control-menu box and title bar; can't include Maximize or Minimize buttons. Not resizable.
vbFixedToolWindow 4 Fixed ToolWindow. Displays a non-sizable window with a Close button and title bar text in a reduced font size. The form does not appear in the Windows taskbar.
vbSizableToolWindow 5 Sizable ToolWindow. Displays a sizable window with a Close button and title bar text in a reduced font size. The form does not appear in the Windows taskbar.

The BorderStyle property settings for MS Flex Grid, Image, Label, OLE container, PictureBox, Frame, and TextBox controls are:

Setting Description
0 (Default for Image and Label controls) None.
1 (Default for MS Flex Grid, PictureBox, TextBox, and OLE container controls) Fixed Single.

The BorderStyle property settings for Line and Shape controls are:

Constant Setting Description
vbTransparent 0 Transparent
vbBSSolid 1 (Default) Solid. The border is centered on the edge of the shape.
vbBSDash 2 Dash
vbBSDot 3 Dot
vbBSDashDot 4 Dash-dot
vbBSDashDotDot 5 Dash-dot-dot
vbBSInsideSolid 6 Inside solid. The outer edge of the border is the outer edge of the shape.

Remarks

For a form, the BorderStyle property determines key characteristics that visually identify a form as either a general-purpose window or a dialog box. Setting 3 (Fixed Dialog) is useful for standard dialog boxes. Settings 4 (Fixed ToolWindow) and 5 (Sizable ToolWindow) are useful for creating toolbox-style windows.

MDI child forms set to 2 (Sizable) are displayed within the MDI form in a default size defined by the Windows operating environment at run time. For any other setting, the form is displayed in the size specified at design time.

Changing the setting of the BorderStyle property of a Form object may change the settings of the MinButton, MaxButton, and ShowInTaskbar properties. When BorderStyle is set to 1 (Fixed Single) or 2 (Sizable), the MinButton, MaxButton, and ShowInTaskbar properties are automatically set to True. When BorderStyle is set to 0 (None), 3 (Fixed Dialog), 4 (Fixed ToolWindow), or 5 (Sizable ToolWindow), the MinButton, MaxButton, and ShowInTaskbar properties are automatically set to False.

Note   If a form with a menu is set to 3 (Fixed Dialog), it is displayed with a setting 1 (Fixed Single) border instead.

At run time, a form is either modal or modeless, which you specify using the Show method.

Show:
© 2016 Microsoft