Programming & Scripting Tutorials

Visual Basic: Labels and External Files





Labels in VB are handled very similarly to textboxes.
We can set the default label text by using the properties panel, and we can change a label's text by using the labels name (for example Label1) ".Text".

Lets say that we wanted to create a progam in which the label reacted to the button being pressed.
Drag a button and a label onto your form.
Go into the button click code and type something like this:

Label1.Text = "Hehe. That tickes ^_^"


If we run the program the label's text will now change to this when the button is pressed.


Sometimes you will want to execute external programs using Visual Basic - with the shell command you can do this!

Here is an example of using the shell command:

Shell "path\filename.extension"


The above is a relative path, you could also use a fixed path, like so:

Shell "C:\Windows\regedit.exe"


This Visual Basic tutorial was written by


Back to Visual Basic

Advertisement: