0% found this document useful (0 votes)
7 views

Computer Reviewer 3q

1. This document discusses variables, constants, data types, and operators in Visual Basic. Variables store data that can change, while constants store fixed data. Basic data types include integers, long, short, single, double, string, boolean, datetime, decimal, and char. 2. Operators allow mathematical and logical manipulation of variables. Arithmetic operators include addition, subtraction, multiplication, division, exponentiation, and modulus. Logical operators include OR, AND, and NOT, and are used to evaluate boolean expressions. 3. Relational operators like greater than, less than, equals, not equals, greater than or equals, and less than or equals are used to compare values.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Computer Reviewer 3q

1. This document discusses variables, constants, data types, and operators in Visual Basic. Variables store data that can change, while constants store fixed data. Basic data types include integers, long, short, single, double, string, boolean, datetime, decimal, and char. 2. Operators allow mathematical and logical manipulation of variables. Arithmetic operators include addition, subtraction, multiplication, division, exponentiation, and modulus. Logical operators include OR, AND, and NOT, and are used to evaluate boolean expressions. 3. Relational operators like greater than, less than, equals, not equals, greater than or equals, and less than or equals are used to compare values.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Lesson 3-Basic Control and its Essence VARIABLES AND CONSTANT

Variables

A. Creating VB Application Using Button, –are the memory location(address) that holds
Textbox and Label data that can be changed during project
execution.
-The function of Button is to carry out a
command or action (event) as the user clicks Constants
it,while the Textbox provides the area for
-are the memory location that holds data that
input and output display in text format. This
cannot be changed during the execution of
control is used to extract simple responses
from the user or to invoke special functions of
the form. A Label control is used to display
descriptive text for the form in control. It does Data Types
not participate in user input or keyboard or –indicates what particular type of data or
mouse events. information will be stored in the allocated
memory space

B. Using Check boxes, Radio buttons and


Message Basic data types of Visual Basic:
-A message box is usually used for displaying 1.Integer
messages to the user In a graphical user
interface (GUI) mode. Moreover, the –it is a data type that deals with whole
checkboxes are used when there are options numbers.
or choices that need more than one to 2.Long
choose. Meaning the user has an option to
check as many choices as they want using the -it is a data type that deals with bigger range
checkbox object place in the developed of whole numbers than integer. This data
application. In the Radiobutton object, the type has 8 bytes storage size.
user can only select one option at atime.
3.Short

-a data type that deals with whole numbers


C. The Timer Control also but smaller than integer and long integer

-This control is used if part of our application 4.Single


is to check the computer system clock.
-a number with fractional part or decimal
point.

d. Date Time Picker Control 5.Double

-This control is used in an application when –a number with fractional part or decimal
the user wants to select current, previous and point that holds data values of 1.8 times 10
future date. to the power of 308th with 8 bytes storage
size.

6.String
Lesson 4: VARIABLES AND CONSTANT
DECLARATION –a sequence of an alphanumeric data that are
enclosed with double quotation marks
7.Boolean

-a data type that holds true or false value. Parse

8. DateTime - Parse method changes the string


representation of a number to its passed
-a data type that holds date and time value
equivalent.
with 8 bytes storage size.
- Parse is the method that is called with a
9.Decimal
numerical data type that must precede it to
–a data type that holds large numerical value determine what data type the conversion will
with 16 bytes of storage size. be.

10.Char

-a data type that holds single character Lesson 5: VB OPERATORS

Sample Identifiers: Operator

Possible Identifiers –is a symbol that tells the compiler to


perform specific mathematical or logical
1. Social_Security_number-String manipulations.
2.Payrate-Decimal

3.Hoursworked-Decimal A. Arithmetic Operators


4.Phonenum-String Arithmetic operations
5.Quantity-Integer - used particularly when there are
6.Tax_rate(constant)-Decimal computations involved in the application
system you are developing. These operators
include:
Declaring variables for the computations: ❖Addition ( + )
Syntax: Dim identifier [as data type]
❖Subtraction ( -)
Dim Quantity As Integer
❖Multiplication ( * )
Dim Price As Decimal
❖Division ( / )
Declaring Constant:
❖Exponentiation ( ^ )
ConstDiscount As Decimal=0.25D
❖Modulus ( mod )
Constidentifier [as data type] = value
❖Integer division ( \)

Note:
Dim
➢The integer division (\) is used to divide
- Dim statement to determine the variable's
one integer by another integer, and give an
data type and other information, such as
integer result and truncating or dropping any
what code can access the variable.
remainder.

Example: TotalSales=160
TotalSales=TotalSalesInteger\60 C>B=T

Result: 2 B>A= T

➢The mod operator (mod) returns the Logical Operators


remainder of a division operation.
-Have one or two boolean operands that
Example: MinutesInteger=150 yield a boolean result

MinutesInteger=TotalMinutesInteger mod 60 Symbols:

Result: 30 Or (II)

-If one expression or both expressions are


true, the entire expression is true
EXAMPLES:
• T or T = T
10 + 23% 10 = 13
• T or F = T
(100-50) * 2 = 100 • F or T = T
• F or F = F
120/10 + (7+5) * (10-5) = 72

64% 7 * (5-3 * 20-10*4) = -95


And (&)
50-10* (2% 6 + (5-3) = 80
-both expressions must be true for the entire
expression to be true
Relational Operation
• T and T = T
-compare two values and determine the • T and F = F
relationship between those values • F and T = F
• F and F = F

Symbols:
Not (!)
> (GREATER THAN)
-Reverses the condition
< (LESS THAN)
• !T = F
= (EQUALS SIGN)
• !F = T
<> (NOT EQUAL TO)

>= (GREATER THAN IR EQUAL TO)


EXAMPLES:
<= (LESS THAN OR EQUAL TO)
!T II F and T = F

T && I F II T = T
BOOLEAN RESULTS:
T II T && F II T = T
EXAMPLES: Given: A = 2, B = 3, C = 4
!F II !T II F && (T II F) = T
A>B=F
!(T II F && ! II F && F II F) = T
C<A=F
F && (T II F II (T II F && T II F) = F
A=C=F

You might also like