Simple Computer Programming - Visual Basic

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!

Lets start with one of the most famous programs ever written. Whenever we start learning a language a very common first step is to learn how to get the computer to print something onto the screen. We will create a form for inputting data to the computer. We will use this form to get the computer to print the famous "Hello World!" message, 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 menu, 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!


The Illustrations

Click thumbnail to view full-size
Blank FormPropetties MenuSuccsesfull Program!
Blank Form
Blank Form
Propetties Menu
Propetties Menu
Succsesfull Program!
Succsesfull Program!

How many programming languages have you learned?

  • Visual Basics is my first programming language!
  • I know at least one programming language.
  • I am well versed in more than two programming languages.
See results without voting

Final Words

Learning a programming language can be terrific fun and a very useful skill to have. But when you're getting started in this journey remember that mastering programming, like any other skill, will take a long time!

Here are some awesome resources where you can learn more about Visual Basics;

The Microsoft Guide:
This is a great comprehensive introduction to the Visual Basic language. It's a perfect resource for beginners and experts.

Tutorials Point:
An awesome introduction to Visual Basics written in clear and easy to understand language. The guide covers the key components of the language, along with plenty of neat tricks and programming recipes! If you're new to VB this will be a great place to start.

More by this Author


Comments 5 comments

nonny126 profile image

nonny126 7 years ago

lol i could not live without my computer and my sellphone


COmputer BUSY 7 years ago

Nice guide, I find the visual basic syntax rather apealing for simple programs


Hi 7 years ago

I tried your code, it worked! What else can I do with baisics?


days leaper profile image

days leaper 6 years ago from england

Is 2008 express version easier to learn than 2003, ie...(.net)?

And do please teach us more!!!

encore...


Migodden profile image

Migodden 6 years ago from Canada Ontario Author

I havent actually tried the 2003 version so I am not sure. However I imagine that it probably should not be too much different for a begginer. Thanks for your comment!

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working