Raddy`s Blog

22May/100

OOP – Object Oriented Programing

I have made quick PowerPoint about OOP. In the PowerPoint you will find information such as History, Advantages/Disadvantages and some compering between two OOP`s.

I made this for one of my programing lessons and this PowerPoint can be helpful for BITEC NATIONAL DIPLOMER IN IT.

Object Oriented Programing PowerPoint

Enjoy

17Dec/090

Visual Basic 2008 – Variables

First of all I am going to explain what variable is. For those of you who already know just skip this part.

A variable is something that you can store any value in as you work through your algorithm. You can make a decisions based on the value for example ( is your value equal to 5 or is more than 6). Also you can perform operations on that value to change it into something else... for example add some number to the value( 4 + the value minus 2, and so on).

How to create a variable and work with it.

1) First create new Visual basic Project.

New VB 2008 project

New VB 2008 project

2) Add a button control from the ToolBox to the stage your working on. Set the button to Text property Add 2 to Number and the name property to btnAdd.

The button should looks like that:

Visual Basic 2008 button

Visual Basic 2008 button

3) Double click on the button(Add 2 to Number) and this will bring you to code view. Now copy the code:

Dim Number As Integer
Number = 20
Number = Number + 2
MessageBox.Show("Value of Number + 2 = " & Number.ToString, "Variables")

Your code shoud looks like that:

Simple Variable coding

Simple Variable coding

4) OK now you have done the coding bit. To test the program click on the little green button above your tabs. Now what is happening is that the number 20 + 2 should give you an answer of 22. Is your right?

Every variable starts with Dim then the name and the type. Example: Dim Name As String.

What I have done in the code is I set a Dim, the name was Number and the type As Integer. You should learn all types before start any coding. (Integer, Decimal, String....)

I have told the form that the variable Number is equals 20 ( Number = 20). After this i set that the Number is equals the Number itself plus 2 ( Number = Number + 2)

And on the last code I simply outputted that answer in Message Box. (MessageBox.Show(Number.ToString) and I added some text in the open and closed brackets.

This is it. You just learned how the variables work and how to use them.