This Visual Basic code defines a form with three buttons. When each button is clicked, it changes the text, autosize property, and text alignment of a label on the form. Button1 sets the label to display "HI!" aligned to the middle left. Button2 sets it to "HELLO!" in the middle center. Button3 changes it to "WHAT'SUP?!" and aligned to the middle right.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
46 views
Exercise 11
This Visual Basic code defines a form with three buttons. When each button is clicked, it changes the text, autosize property, and text alignment of a label on the form. Button1 sets the label to display "HI!" aligned to the middle left. Button2 sets it to "HELLO!" in the middle center. Button3 changes it to "WHAT'SUP?!" and aligned to the middle right.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Exercise 11
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click With Me.Label1 .Text = "HI!" .AutoSize = False .TextAlign = ContentAlignment.MiddleLeft End With End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click With Me.Label1 .Text = "HELLO!" .AutoSize = False .TextAlign = ContentAlignment.MiddleCenter End With End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click With Me.Label1 .Text = "WHAT'SUP?!" .AutoSize = False .TextAlign = ContentAlignment.MiddleRight End With End Sub End Class