Appearance and BorderStyle Properties for Visual Basic 6.0 Users
The Appearance and the BorderStyle properties in Visual Basic 6.0 are used to control the appearance of controls.
The Visual Basic 6.0 Frame, Image, Label, PictureBox, and TextBox controls support both the Appearance and BorderStyle properties. Setting a combination of the two properties makes the control appear with no border, with a single line for a border, or with a three-dimensional border.
In Visual Basic 2008, the Appearance property no longer exists for these controls. Its functionality has been combined with the BorderStyle property to set the appearance in a single step.
The Visual Basic 6.0 CommandButton, ListBox, and ComboBox controls support only the Appearance property.
The Visual Basic 2008 Button control has a FlatStyle property that is equivalent to the Appearance property. The ListBox control can be made to appear flat by setting the BorderStyle property to FixedSingle. The ComboBox control never actually supported a flat appearance in Visual Basic 6.0, so there is no equivalent.
Visual Basic 6.0 forms also have a BorderStyle property that supports a different set of values. This is replaced by the FormBorderStyle property in Visual Basic 2008.
The following code example illustrates the differences in coding techniques between Visual Basic 6.0 and Visual Basic 2008.
Code changes for changing the appearance of controls
The following example demonstrates setting properties to change the appearance of controls at run time.
' Visual Basic 6.0 ' Give a TextBox a flat look with no border. Text1.Appearance = 0 Text1.BorderStyle = 0 ' Give a TextBox a three-dimensional appearance. Text1.Appearance = 1 Text1.BorderStyle = 1 ' Give a CommandButton a flat look Command1.Appearance = 0 ' Give a ListBox a flat look List1.Appearance = 0
' Visual Basic ' Give a TextBox a flat look with a single border. TextBox1.BorderStyle = BorderStyle.None ' Give a TextBox a three-dimensional appearance. TextBox2.BorderStyle = BorderStyle.Fixed3D ' Give a Button a flat look Button1.FlatStyle = FlatStyle.Flat ' Give a ListBox a flat look ListBox1.BorderStyle = BorderStyle.FixedSingle
The following table lists Visual Basic 6.0 Appearance and BorderStyle constants and their Visual Basic 2008 enumeration equivalents.
Visual Basic 6.0
Visual Basic 2008 Equivalent
BorderStyle = 0 – None
Appearance = 0 – Flat
BorderStyle = 1 – Fixed Single
Appearance = 1 – 3D
BorderStyle = 1 – Fixed Single
When upgrading a Visual Basic 6.0 application using the Upgrade wizard, Frame controls can be upgraded to either Visual Basic 2008 GroupBox or Panel controls. Appearance and BorderStyle mappings apply only to those Frame controls that are upgraded to Panel controls; there is no BorderStyle property for GroupBox controls. For more information, see Frame Control for Visual Basic 6.0 Users.
When upgrading ComboBox, CommandButton, and ListBox controls, the Appearance property is not mapped. If the Appearance property is set in code, an upgrade warning will be added.