Simple Computer Programming - Visual Basic
70
What is programming?
Your everyday life is impacted greatly by the use of computers, they run everything from traffic lights to your monitor screen which your using right now. The question is how do they work? Computers are given instructions on how to behave, they are told how to react under certain conditions by a programmer. In our case you are the Programmer, your job is tell the computer what to do, and when to do it. You do this by speaking to the computer in a language it understands, there are several languages computers use to speak with humans. Some are more complex than others, all of them can allow you to command your computer. Programming a computer to do simple tasks can be relatively simple, but with determination an analytical mind can create great programs capable of helping millions of people.
Visual Basic
A complex language does not necessarily mean a powerful one. Computer languages range in great variety, each language has it's pros's and con's. The greatest language to learn for beginners however is Visual Basics, this language takes minutes to learn and ages to master. To begin programming in Visual Basics your going to need to download the compiler. The Visual Basic compiler is a free software created by Microsoft and you can download it here. This compiler lets you use drag and drop functions to set up your programs.
Get Started!
Now that you have your compiler, lets get started! To get started with your first computer program on Visual Basics open up your Visual Basics 2008 Express Edition software you have just installed. Note: You may need to restart your computer before you can start using the software. Once opened click File -> New Project this will open up an interface asking you to name your program, do so then click OK. You should now have the blank slate that is your program, time to get busy!
Hello World!
The first program we will give the computer, is to ask it to display a message on your form. Your form is illustrated bellow. We will ask the computer to say "Hello World!", so lets get started. On the top right of the software you will see a tab that says 'Tool Box" click it and then under the all windows forms tab find "label", click it to insert your first object. The label is a new object to your program, this object will display the text to your form. Once the object is placed it is automatically given a name, by default your label is named Label1. You can change the label name in the property menue, illustration bellow. Now that you have your object: your label, lets use it to ask the computer to display a message! To do this double on your form, click out side of the label you placed. Clicking will bring you to an interface where you will see a bunch of code already set out for you. It should look something like this:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
To place your message on your form enter in this code as shown bellow to the interface:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = "Hello World!"
End Sub
End Class
Remember "Label1" is your object, ".text" tells the computer you want to display text and Finlay " = "This is your message" ". Once you have entered the code to your form click the green play button on the tool bar at the top to run your program. If you get the result depicted bellow congratulation you have made your first simple computer program!
PrintShare it! — Rate it: up down flag this hub
Comments
Nice guide, I find the visual basic syntax rather apealing for simple programs
I tried your code, it worked! What else can I do with baisics?










nonny126 says:
4 months ago
lol i could not live without my computer and my sellphone