Data
Design a program’s interface of an application using ( Visual
[Link] ) language .
Insert and adjust properties of controls using properties window in
design mode.
On entering these data, it is temporarily stored in the computer
memory (RAM). To deal with these data we must assign a name
and a type to it in memory.
Data
Types
Numeric Character Miscellenous
Data Types Data Types Data Types
Non Integer Integer Declared by :
Numeric Types Numeric Types Declared by :
/ Decimal Object - Date -
Declared by : String - Char Boolean
Declared by :
Byte - Short -
Single - Double Integer - Long
- Decimal
Important Notes:
Each data type occupies a storage space in the memory, for example: the integer
data types occupy 4 bytes of memory storage
Each data type has a range of values, for example: the range for the Byte starts with
“0” and ends with “255”
Miscellaneous Data do not fall under the Numeric or Character types and declared
date and time by Date and object by Boolean and takes the value (True or False)
Constants and Variables
First Constants
They are places reserves in(RAM) that have data types on
declaring constants, name and data types are determined for them
and take fixed value and do not change during the program
Declaring constants is a statement in which the name and type of
data and value of it are defined through a certain code.
We declaring by the order:
Const Constant_Name As Data Type = Value
Declaration constants/ name of the constant /type of data /constant value
Examples:
To declare a constant string value in RAM:
Const C_Name As String = “ جمهورية مصر العربيه
To declare a constant single value in RAM:
Const Pi As Single = 14.3
To declare a constant date value in RAM:
Const BirthDate As Date = # 1/25/2004 #
Note:
The double quotes “ “ are used if the value of constant is string value
The hashes # # are used if the value of constant is date or time
Second Variables are reserved placed in computer memory,
declared and determined by its name and type and its value usually
changes during the program
Declaring variables: We declaring by the order:
Dim Variable_Name As Data Type [ =Initial Value ]
Declaration variables/ name of the variable /type of data /initial value
Examples:
To declare a variable string value in RAM:
Dim F_Name As String
To declare a variable single value in RAM:
Dim Total_Price As Single
To declare a variable date value in RAM:
Dim Today As Date = # 1/25/2004 #
Note:
The initial value is a choice and if you ignore it, the variable will
take zero in numeric variable and an empty string in character
variable
Naming rules of Constants & Variables
Must begin with letter or underscore (_)
Should not contain symbols or special characters like: (? *, -, …)
Do not use reserved words (keywords) such as (single, integer,…)
Assignment statement
It is assigning a value to a constant or variable and has two sides
Left side = Right side
The variable to store the value/ assignment operator /the value
Example:
Variable = Abstract value A=5
Variable = The value of a variable A = 5, B = A
Variable = The value of Expression A = 5, B = A + 3 * 2
Property = Value relay on the property [Link] =” Egypt”
Important notes:
If we want to show the result in a certain way in the From, we use
signs and symbols as follows:
Me express the current windows Form
Separated each variable and the other by the concatenation symbol
(&)
The reserved word (vbCrLf) is used to create a new line
Use the symbol (_) to write on more than one line if the code line
is too lone
The programmer can use the command (REM) in writing remarks
that can referred to within the code, it is not complied.
Priority rules for Arithmetic operation
1-Applying the process inside the brackets from inside to outside.
2-Applying the exponent.
3-Applying multiplication or division process from left to right,
wherever come first.
4-The application of the addition or subtraction process from left to
right wherever come first.
*Be sure when you make this calculation to avoid the logic error.
Errors
The error message on writing a code or not executing of command,
getting the wrong result and the program does not run.
Errors
Runtime Logic Syntax
Errors Errors Errors
It happens when we get They are errors in
Are discovered the command
incorrect results after
while running the syntax commands
executing the program
program and occur of the language and
because of the wrong
when the value is easy to detect
formulation arithmetic
out of range beacause the (IDE)
or logic expression and
to avoid we must helps us
review the written code
and test the program
With my best wishes/
Sahar Medhat