Many ways to write any program

If you were going to tell someone how to drive from school to your house, you could write several sets of directions, all of which would work when they were followed. Similarly, there are many ways to write any program. Consider, for example, this program moves a label up and down on a form.

One way to move it to the top of the form would be to assign a low numeric value like 24 to its Top property:

Private Sub ... Handles btnUp.Click
	lblGreeting.Top = 24
End Sub

Another approach would be to create a tall label, and assign a value to its TextAlign property:

Private Sub ... Handles btnUp.Click
	lblGreeting.TextAlign = ContentAlignment.TopCenter
End Sub
This moves the lettering up and down within the label, so you have to make the label very large -- filling the center of the form.

A third way would be to create three labels, one at the top, one at the bottom and one in the middle. To display only the top label, you would assign the value True to its Visible property and assign the value False to the Visible properties of the other two labels.

Private Sub ... Handles btnUp.Click
	lblGreetTop.Visible = True
	lblGreetMiddle.Visible = False
	lblGreetBottom.Visible = False
End Sub

Disclaimer: The views and opinions expressed on unofficial pages of California State University, Dominguez Hills faculty, staff or students are strictly those of the page authors. The content of these pages has not been reviewed or approved by California State University, Dominguez Hills.