locations that are used to handle values and
ICT REVIEWER such values may change continuously; It is
RadioButton Control important to name Variables as well as
declaring its data type; Dim Score As Integer
- Allows only one option to be selected of
several available options Rules in NAMING VARIABLES
- If the user has to select the languages - No spacing is allowed
known to him or can be spoken by him, - Make the variable name short as much
then the best option would be to have as possible
check boxes, as it’s quite possible for a - No special character is allowed except
person to speak/know more than one underscore
language - Do not start with a number
- 2 states: true, false - You may start variable name with
CheckBox Control underscore
- It must be less than 255 characters
- Allows one or many options to be - There is proper way of typing variable
selected name
- If we were asking a user to select the
highest qualification, it would be either Declaring Variable – declare the variables
PG or graduation or some other before using them by assigning names and data
professional course. In that case, we types. Failure to do so = program will show
would go with a radio button. error.
- 3 states:Checked, Unchecked, Dim VariableName as DataType
Indeterminate
Or
Drag GroupBox onto the selected group
Dim VariableName1 as DataType,
Tab Control – allows to manage the content of VariableName2 as DataType
the program
Or
Constant – value that cannot be changed;
constant value; const (Integer-number value) Dim VariableName1, VariableName2 as Data
Type
Variable – storage; we put value in it; Dim
To String CONVERTER – format the value
Assigning value to Variable
String – text, character, etc.
Variable=Expression; The variable can be
- Declaring in Private, other controls declared variable or a control property value.
have no access; declaring in Public, all The expression can be a mathematical
controls have access expression, a number, a string, a Boolean value
VARIABLE – the act of defining a variable is and more
called declaring (something dimensioning) Dim _score As Integer = True
which is most commonly accomplished using
the keyword Dim (short for Dimension); Dim _score As Integer = 1
Variables in programing are data storage
Dim _score As Integer = _score + 1 Visual Basic DATA TYPES
Or Visual Basic divides information into two major
data types: numeric and non-numeric data
Dim _score As Integer _score = 1
types
Numeric – types of data composed of numbers
Constant – Constants are different from that can be calculated mathematically using
variables in the send that their values do not arithmetic operations; can be classified into
change when the program is running; the syntax seven types based on the range of values they
to declare a constant is: can store
Const ConstantName as Data Type = VALUE
Const Pi as Single = 3.1416
Const Temp as Single = 37
Things to remember!
• VB divides information into two major types:
Numeric and Non-numeric
• Variables are data storage location used to
handle values.
• Numbers are considered as string when the
variable that stores it is declared as String data
type.
PictureBox – used for putting pictures Non-numeric – data that cannot be processed
mathematically using arithmetic operations
Timer – stopwatch
Smart Tags – allows easy access for commands
Dock – fit
Interval – between ticks; higher the interval, the
slower the tick
Enabled – control to work; true, false
- Declare a variable in public so that all
controls will access it
Loop (-) – if statement
GUIDELINES IN CHOOSING DATA TYPES
- Reset counter to 0
- Use the string data type in a variable
when storing texts. Texts are composed
of letters, valid special characters, and
numbers.
- Use the Boolean data type in a variable
when storing TRUE or FALSE.
- If storing numbers without decimal
values but with a small range of values,
use the Short data type.
- If storing numbers with decimal values
but with small range of values, use the
Single data type. Otherwise, if a larger
range of values is required, use Double
data type.
- If storing Currency values, use the
Currency data type.
- Use the Date data type if storing date
values. Visual Basic recognizes date
format such as 1/20/2011 that
represents January 20, 2011.
- Use data type according to its
convention and range of values.