How to Change the Text Color of Labels in VB6.0

104 19
    • 1). 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

    • 2). 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."

    • 3). 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

Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.