Friday 11 October 2013

Dealing with variables in VB.NET.

How to create variables in VB.NET?              

                With Visual Basic, and most programming languages, what you are doing is storing things in the computer's memory, and manipulating this store. If you want to add two numbers together, you put the numbers into storage areas and "tell" Visual Basic to add them up. But we can't do this without variables.

For ex:


Dim var1 As Integer
Dim var2 As Integer

var1= 10
var2= 15

This code is used to setting up the variables in the VB.NET.
Dim
Short for Dimension. It's a type of variable. we declared  that we  are setting up a variable with this word. We'll meet other types of variables later.
var1
This is a variable. In other words, our storage area. After the Dim word, Visual Basic is looking for the name of our variable. we can call our variable almost anything you like such num1, x, y and so on. But there are a few reserved words that VB won't allow.
As Integer
We're telling Visual Basic that the variable is going to be a number (integer). Well meet alternatives to Integer later.
var1 = 10
The equals sign is not actually an equals sign. The = sign means assign a value of. In other words, here is where you put something in your variable. We're telling Visual Basic to assign a value of 10 to the variable called varr1. 


<---- Previous page                        Next page ---->

VB.NET HOME PAGE


No comments:

Post a Comment