How to Program in Visual Basic .NET (VB.NET)

Download Visual Basic .NET 2005 edition from http://www.microsoft.com/express/., Open Visual basic., Learn the basic object types., Learn to place an object., Start (debug) your program now., Close your program. , Back at the program platform double...

28 Steps 3 min read Advanced

Step-by-Step Guide

  1. Step 1: Download Visual Basic .NET 2005 edition from http://www.microsoft.com/express/.

    Once downloaded and installed, you are ready to start programming.

    First, you should understand that a computer cannot think and reason and that absolutely everything it does comes from a detailed list of instructions.

    It has to be told, even the smallest steps in great detail.
  2. Step 2: Open Visual basic.

    You will see a window where you can choose different program types.

    Choose Windows application--It will be the one you will use most of the time. , You see a window within a gray window with a grid of black spots.

    This is your program platform.

    This is where you add different objects.

    The basic objects in Visual Basic (VB) are the button, the textbox, the editbox, the checkbox, and the label. , On the left side of your screen you will see a toolbox with a lot of objects.

    Click on the one that says button.

    Then click on the gray window.

    The spot you click will be where your button is placed. , Congratulations, you've just made your first program! When you click your button see what happens; absolutely nothing.

    Let's do something about that. ,, Now there is a displayed window a bit like a notepad.

    This where you tell the program what to do. ,, Click the button.

    Now what happens? A new window is popping up saying hello world, and you just finished the first program in VB... this is the program all begin with. ,, This label will be called label1 (as long as you are working on smaller programs it is alright but when you move up to more complicated programs with multiple labels buttons editboxes it is very difficult to remember which button does what).

    Single click on your label.

    In the right side of the screen there is a property window, in this there is one called text, this is where you define the text of the label, clear this one.

    Find the property called name, change this to lab_output that way you know that it is a label and that it gives you an output of some kind or at least it will. , Rename the button too and the text as well.

    Change the button to add. , Let's gets started with the coding part.

    Double click the button delete the msgbox("hello world") and nothing else. ,,,,, \newline end , You can do the same with other mathematical operations, add new buttons for each operation on the platform, and you can make yourself a basic calculator. , You can define what is called a variable.

    At the very top of the coding window you have a sentence starting with private sub or something like that.

    Under this you write dim a,b as decimal.

    Other variables is string integer boolean, all these are in the help manual, for now the decimal is all you need. ,,,
  3. Step 3: Learn the basic object types.

  4. Step 4: Learn to place an object.

  5. Step 5: Start (debug) your program now.

  6. Step 6: Close your program.

  7. Step 7: Back at the program platform double click the button.

  8. Step 8: At the place of the cursor write msgbox("hello world")

  9. Step 9: Debug your program.

  10. Step 10: Lets write another program go to your program platform.

  11. Step 11: Add a label.

  12. Step 12: Go back to your program platform add 2 editboxes rename them (edit_a)

  13. Step 13: (edit_b) and clear the text field

  14. Step 14: the boxes are the input of your program.

  15. Step 15: You probably now know we are making a program that can add 2 numbers.

  16. Step 16: Write lab_output.text = ("edit_a.text + edit_b

  17. Step 17: text").

  18. Step 18: This will make the program add whatever stands in the editboxes.

  19. Step 19: If the program is debugged now and you click the add button you get an error.

  20. Step 20: In order to avoid the error

  21. Step 21: make use of an if/then else sentence which is where the program is asked if a statement is true if it is then it does something if not then it does something else.

  22. Step 22: In the Code for the button be fore you write the lab.... You write if edit_a.text=("") or edit_b.text=("") then \newline msgbox("write something to add")\newline else \newline lab_output.text = ("edit_a.text + edis_b

  23. Step 23: text").

  24. Step 24: You made a program that can add 2 numbers.

  25. Step 25: Now there is a little something because the edit_a.text is annoying to write all the time.

  26. Step 26: Underneath your dim write a=edit_a.text b= edit_b.text

  27. Step 27: Go back down to your button code change the edit_a.text and edit_b.text to your newly defined variables a and b.

  28. Step 28: Debug your program.

Detailed Guide

Once downloaded and installed, you are ready to start programming.

First, you should understand that a computer cannot think and reason and that absolutely everything it does comes from a detailed list of instructions.

It has to be told, even the smallest steps in great detail.

You will see a window where you can choose different program types.

Choose Windows application--It will be the one you will use most of the time. , You see a window within a gray window with a grid of black spots.

This is your program platform.

This is where you add different objects.

The basic objects in Visual Basic (VB) are the button, the textbox, the editbox, the checkbox, and the label. , On the left side of your screen you will see a toolbox with a lot of objects.

Click on the one that says button.

Then click on the gray window.

The spot you click will be where your button is placed. , Congratulations, you've just made your first program! When you click your button see what happens; absolutely nothing.

Let's do something about that. ,, Now there is a displayed window a bit like a notepad.

This where you tell the program what to do. ,, Click the button.

Now what happens? A new window is popping up saying hello world, and you just finished the first program in VB... this is the program all begin with. ,, This label will be called label1 (as long as you are working on smaller programs it is alright but when you move up to more complicated programs with multiple labels buttons editboxes it is very difficult to remember which button does what).

Single click on your label.

In the right side of the screen there is a property window, in this there is one called text, this is where you define the text of the label, clear this one.

Find the property called name, change this to lab_output that way you know that it is a label and that it gives you an output of some kind or at least it will. , Rename the button too and the text as well.

Change the button to add. , Let's gets started with the coding part.

Double click the button delete the msgbox("hello world") and nothing else. ,,,,, \newline end , You can do the same with other mathematical operations, add new buttons for each operation on the platform, and you can make yourself a basic calculator. , You can define what is called a variable.

At the very top of the coding window you have a sentence starting with private sub or something like that.

Under this you write dim a,b as decimal.

Other variables is string integer boolean, all these are in the help manual, for now the decimal is all you need. ,,,

About the Author

J

Jean Fisher

Writer and educator with a focus on practical pet care knowledge.

34 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: