Visual Basic labels help with navigation of your desktop applications. Visual Basic 6.0 is an older language used to create Windows software. Labels are placed adjacent to text boxes, drop-down boxes or other controls to tell the user what to enter for input. Labels are drawn with a black font by default. However, you can set the label's text color to match your application's color scheme.
Create the label variable. The label is created in code using the "Label" class. The following code shows you how to create a VB label:
Dim lbl As Label
Assign some text to the label. Text is assigned to the label using the "Caption" property in VB6. This changes in VB.NET, which uses the "Text" property. The following code adds text to your label:
lbl.Caption = "My label text."
Change the text color using the forecolor property. VB6 has color constants that make it easy to change the label's text color (see "Resources"). The following code changes the label's text to red:
lbl.Forecolor = vbRed
- Photo Credit text image by Ewe Degiampietro from Fotolia.com
How to Highlight Text in a Text Box in VB.NET
Visual cues in a software application can help make a user's experience more enjoyable and productive. If you create VB.NET programs, you...
How to Create a Hyperlink in Visual Basic
Hyperlinks in programs make it very easy for people to go directly from a program to a Web page, which are usually...
How to Change Font Color in Visual Basic
Developing a user-friendly and vibrant color application using Visual Basic, or VB, can be as easy as adding text to a control....
How to Convert a Textbox to a Number in Visual Basic
Microsoft's Visual Basic contains some powerful functions that make the programmer's life easier. One such example is the ability to convert data...
How to Change the TextBox Border Color in Visual Basic
Microsoft's Visual Basic allows user input via the TextBox control, and the various properties of the control allow the programmer to make...
How to Change the DataGrid Color in VB6
Users like to see data in an organized and easily accessible format. The Microsoft DataGrid control does just that. It is a...
Visual Basic ListView Tutorial
The ListView control in Visual Basic became popular with Windows Explorer. This control works in conjunction with the TreeView control and is...