Visual Basics Lesson 5: Labels
Visual Basics Lesson 5: Labels
S
Visual Basic: Lesson 5
Prepared by:
A.A. Gonzaga
Labels
Labels hold the primary text that
appears on a form. Often, programmers
use labels to place titles in forms and
to label text boxes so that users know
what to type into the text box.
Common labels
properties
Property Description
Alignment Determines whether the label’s caption appears left-
justified, centered, or right-justified within the label’s
boundaries.
AutoSize Enlarges the label’s size properties, when True, if you
assign a caption that is too large to fit in the current
label’s boundaries at runtime.
BackColor Specifies the label’s background color. Click the
BackColor palette’s down arrow to see a list of colors
and click System to see a list of common Windows
control colors.
Property Description
BackStyle Determines whether the background shows
through the label or if the label covers up its
background text, graphics, and color.
BorderStyle Determines whether a single-line border
appears around the label.
Caption Holds the text that appears on the label.
Enabled Determines whether the label is active. Often,
you’ll change the Enabled property at runtime
with code when a label is no longer needed.
Font Produces a font dialog box in which you can
set the caption’s font name, style, and size.
Property Description
ForeColor Holds the color of the label’s text.
Height Holds the height of the label’s outline in twips.
Left Holds the numbers of twips from the label’s
left edge to the Form window’s left edge.
MousePoin Determines the shape of the mouse cursor
ter when the user moves the mouse over to the
label.
TabIndex Specifies the order of the label in the focus
order. Although labels cannot receive focus,
they can be part of the focus order.
Property Description
ToolTipText Holds the text that shows as a ToolTip at
runtime.