Private Sub Byval As Byva As Handles Mybase: Form1 - Load (Sender System - Object, Le System - Eventargs) .Load
Private Sub Byval As Byva As Handles Mybase: Form1 - Load (Sender System - Object, Le System - Eventargs) .Load
2 Declaring Variables
In Visual Basic 2010, one needs to declare the variables before using them by assigning names and data types.
If you fail to do so, the program will show an error. They are normally declared in the general section of the codes'
windows using the Dim statement.
The format is as follows:
Dim Variable Name As Data Type
Example 6.1
firstNumber=100
secondNumber=firstNumber-99
userName="John Lyan"
userpass.Text = password
Label1.Visible = True
Command1.Visible = false
Label4.Caption = textbox1.Text
ThirdNumber = Val(usernum1.Text)
total = firstNumber + secondNumber+ThirdNumber
6.3 Constants
Constants are different from variables in the sense that their values do not change during the running of the
program.
6.3.1 Declaring a Constant
The format to declare a constant is
Const Constant Name As Data Type = Value
Example 6.3