![]() ![]() | ||
As in Windows forms, you can set the text in a label with the Text property of Label objects. Here's how that looks in the Labels example when you click the button in that example:
Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = "Hello!" ⋮ End Sub
You can see the results of this code in Figure 15.9.
Note |
The text in this label is pretty big—I've set it to XX-Large, in fact; see "Setting Control Fonts" in this chapter for the details. |
You also can set the border style of labels with the BorderStyle property, and the border width with the BorderWidth property. For example, I'm setting the BorderStyle property of the label in the Labels example on the CD-ROM to a dashed border:
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = "Hello!"
Label1.BorderStyle = BorderStyle.Dashed
End Sub
Note |
To see what types of borders are available, see "Setting Control Border Style" in this chapter. |
![]() ![]() | ||