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

computer__revision_3prepU867z

The document covers key concepts in Visual Basic .NET, including data types, variable and constant declarations, assignment statements, and error types. It also discusses branching and looping statements, procedures, and the risks of cyberbullying, including its forms and protective measures. The content is structured into chapters that detail programming fundamentals and the implications of cyberbullying.

Uploaded by

Pola Ashraf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

computer__revision_3prepU867z

The document covers key concepts in Visual Basic .NET, including data types, variable and constant declarations, assignment statements, and error types. It also discusses branching and looping statements, procedures, and the risks of cyberbullying, including its forms and protective measures. The content is structured into chapters that detail programming fundamentals and the implications of cyberbullying.

Uploaded by

Pola Ashraf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Computer 3rd.

Prep Second Term

Chapter One: Data Types  Constants They are places reserved in the (RAM) and, have
data types.
In VB.net language, there are many Data Types.
You should be declaring the constants and assigning values of
Some Data Types provided by (Visual Basic.Net) are : them.
1) Numerical: These values are a fixed and cannot be changed during
a- Integral : ( Byte – Long – Integer – Short ). program execution.
b- Non Integral : ( Double – Single –
Decimal ). Declaring Constants:
2) Character : ( String – Char ). We use the ( Const) keyword to declare constants.
3) Miscellaneous : ( Object – Date – Boolean).
 Each classification of Data Type has more than one type.
 Each Data Type has:  The double quotes " " are used if the value of variable or
A storage space in the memory: for example the data type constant is a string value.
(Integer); when used, it occupies (4 bytes) .  The hashes # # are used if the value of variable or constant is
A range of values (minimum value and maximum value); for date or time.
example the range of values for the data type (Byte) starts with Naming Rules Variables & Constants:
‘0’ and ends with ‘255’. 1) Variable or Constant names must begin with a letter or
 Variables are reserved places in computer memory (RAM) to underscore ( _ ).
store values temporarily, these values change during the 2) Variable or Constant names should not contain symbols or
running of program. special characters (e.g.: ?, *, ^, -, +, ….. etc. ) .
 Each Variable has a name and Data type. 3) Variable or Constant names consist of letters, numbers, and
 These Data Types are created by declaring variables then underscores ( _ ).
assigning values to them depending on their Data Types. 4) Do not use reserved words (Visual Basic.NET Language
Keywords) such as (single, Dim, As).
Declaring Variables: 5) It is preferable that the Variable or Constant name reflects
 We use "Dim" keyword to declare the variable. its content.

1
Computer 3rd.Prep Second Term

Assignment Statement: Errors:


It is a statement consists of two sides (right hand side and left 1- Syntax Error:
hand side) separated by the assignment operator (=). This happens, when writing code incorrectly.
It consists of taking the value on the right side of the Example: Din x As Single
assignment operator (=) and storing it in the element on the left. The variable (X) was declared but there is a mistake in writing the
word (Dim)
Notes: 2- Logical Error:
"Me" expresses the current window Form. It happens when we get incorrect results after executing
Separates each variable and the other by the concatenation the program because of the wrong formulating arithmetic or
symbol "&". logic expressions
The reserved word (vbCrLf) is used to create a new line. Example:
Use the symbol (_) to write on more than one line if the code Write the code => label2.text = Pi + Radius ^2 instead of
line is too long so you can organize and facilitate the process of The code => label2.text = Pi * Radius ^2 to calculate
reading the (Code). the Area of a Circle.
The programmer can use the command (Rem) in writing  To overcome this type of error, you must review the written
remarks that can be referred to within the code, it is not code, and test the program with data already validated
compiled. 3- Runtime Error:
These errors are discovered when the program is running.
Priority rules for Arithmetic operations:
 It is found in lines of code, where the Assignment Statement
1.Applying the process inside the brackets from the inside to
is written.
the outside.
2. Applying the exponent. Example:
3. Applying multiplication or division process from left to when declaring a variable of type Byte and during the program
right, running, a value that is less than or greater than the allowable
wherever comes first. range is given, i.e. less than (0) or greater than (255) so an error
4. Finally, the Application of the addition or subtraction appears during the run, meaning that the value is out of range.
process
from left to right, wherever comes first.
2
Computer 3rd.Prep Second Term

Chapter Two: Branching Code  "False"


End if
Branching Statement using (If…Then):
The syntax of (If…Then) statement
If conditional Expression Then
Code
End if
If the result of conditional expression
is "True”, the statement after "Then"
is executes until "End If", and if the result is "False" , executes
after "End If" This (If) statement can be written, in one line without writing
(End if)
Where (Mod) is a mathematical operator that computes the
remainder of a division expression; when the remainder of a
Conditional expression division by 2 equals zero, this means there is no remainder;
 is part of a program code; its result can be (True) or (False) therefore it is an even number.
depending on the value of: (a Property or a Variable or another Branching Statement using (Select … Case):
piece of data in the program code). Select …Case Variable
It consists of three parts: Case value1
Code
logical operator preceded by an abstract value.
Case value2
value of a variable or constant or Code
result of mathematical expression Case value3
Branching Statement using (If…Then…Else): Code
The syntax of (If…Then…Else) statement Case else
If conditional Expression Then Code
Code  "True" End Select
Else

3
Computer 3rd.Prep Second Term

Chapter Three: Looping & Procedures  The statements (VB code) are repeated inside the loop until the
counter value reaches the End value.
Looping using (For…Next):
It is one of the limited loop statements used when we want to  If the value of the increment is positive 1, it can be dispensed
repeat a code for specific number of time. with writing (Step Add Value) as the default value to increase the
counter positive 1.
 The syntax of the (For…Next) statement
Looping using (Do While… Loop):
For Variable = Start Value To End Value [Step Add Value]
VB code  The syntax of the (Do While…..Loop):
Next [Variable] Do While Conditional Expression
VB code
Loop
The (Do While...Loop) is used to repeat a specific code for a
several times of an unknown end, but based on a specific
condition, so it is useful if you do not know the number of
iterations .
 The (For...Next) statement should start with the Keyword (For) The code between the beginning of the loop "Do While" and its
and end with the Keyword (Next). end will be implemented as long as the conditional expression is
true.
 "Variable" is the name which represents the counter and its
If the condition is not met for any reason, we get out of the
type must be numeric (integer or decimal).
iterative loop, and implement the code after the Loop if it exists.
 "Start Value" is the start value of the counter or the beginning of Procedure
repetition is a numeric value. A set of commands and instructions under a name, can be
 "End Value" is the value of the end of the counter and the end of recalled by that name, to implement them, and create a (Sub) if
the repetition is also a numeric value. we have a set of commands that are frequently used in more than
 "Add Value" is the increment value of the counter or value over one place in the class.
the counter until it reaches the end value. Procedures must be called by their names.
 "Code" is one or more commands to be replicated between the  Calling a procedure causes the program to execute
beginning of loop (For) and its end (Next). procedure's statements or code.

4
Computer 3rd.Prep Second Term

 Variables and constants, that can be declared either within Declaring and using parameters:
the scope of the (Event procedures) or within the (Class). To solve the previous problem, the procedure
 You can declare the Procedures, this declaration is done only (ShowOddOrEven) must receive the values (1) or (2) on
once, but you recall the procedures many times from anywhere recalling it. this value is used to specify whether the odd
in your program. numbers will be displayed or the even numbers will be
There are two types of procedures in Visual Basic .NET: displayed. So we add the variable (Start) that will be called later.
Sub procedures()‫اﺟﺮاء ﻓﺮﻋﻰ‬
Sub procedures do not return a value ( ),‫ﻻﻳﻌﻮد ﺑﻘﻴﻤﺔ‬while
Functions ( )‫اﻟﺪاﻟﺔ‬procedures.
Functions return a value.
Declaration of Sub Procedures: In figure, a sub Procedure of the name (ShowOddOrEven) has
You can declare a Sub procedure in a class; if we had a code that been declared and a Parameter named (Start) has been also
will be repeated in more than one place in this Class; as well as declared. And used in the code to specify the starting value of
for the organization of this code, and so it will be easy to read and the iteration (repetition), accordingly it display.
understand. Declaration of Function Procedures:
And then modify it if necessary. Function is a set of commands under a particular name that
Declaration Syntax: should express its task. It is applied to Parameters and Returns a
Sub Name (Parameters) value
Code Declaration Syntax:
End Sub Function Function Name (Parameters) As Data Type
Code
1) "Name" reflects the name of the procedure. Return Value
2) "Parameters" reflect the values that were used inside the End Function
procedure code that are used on recalling the procedure. Where:
3) "Code" is a set of orders and instructions carried out on 1) "Name" expresses the name of the function.
recalling the procedure (Sub). 2) "Datatype" identifies the type of the returned value of the
function.
5
Computer 3rd.Prep Second Term

3) "Parameters" represents the parameters that will be used in  Remember:


the code.
4) "Code" is a set of commands and instructions that will be
executed on calling the Function.
5) "Value" is the returned value by the function.

 Remember:
1) Variables: We can assign values to Variables; during the
declaration and the execution of the Program instructions, as
well as using these values stored.
2) Constants: We can assign values to Constants; during the
declaration only, as well as using these values stored.
3) Functions: We cannot assign values to Functions, but
function can be called and returns a value in the light of the
values assigned to the function, as well as using this value Chapter Four: Cyber Bullying
stored. There are many risks that we can be exposed to, including:
getting wrong information.
 Remember: falling prey to some of the aggressors across modes of
It is preferred when naming Functions; give names related to
electronic communication.
their functionality. You can:
 violation of privacy.
1. Declare a Function.
identity theft.
2. Determine its Parameters.
 getting our account stolen (on the social networking sites like
3. Specify the Function type.
Facebook or email).
4. Write Code within this Function.
Subjecting our system to the risk of infection by viruses or
5. Return a value using the Return statement.
spyware, or software piracy and others. • getting wrong
information.

6
Computer 3rd.Prep Second Term

Cyber bullying is a deliberate aggressive ‫ﻋﺪوان ﻣﺘﻌﻤﺪ‬behavior 4. Flaming:


from one person to another through electronic modes of It is a publication of hostile and vulgar words against one or more
communication. through a media and electronic communication.
5. Outing:
Firstly: The forms of cyber bullying:
It is a dissemination of information about a specific person or
1. Harassment
more abusively.
2. annoyance
6. Exclusion:
3. embarrassment
It is to ignore one or more persons through the electronic media.
4. intimidation
7. Cyber threats :
5. threat
It is an email or e-message carrying a threat and intimidation to
6. Blackmailing
one or more persons.
7. . ... Etc.
Fourthly: How to protect yourself from Cyber bullying?
Secondly: The Electronic Media
By following the safe use of the internet as follows:
Electronic media is a technology used by the electronic
1- Don't share your password with anyone.
aggressor, and they are various including the following:
2-Make a password that is difficult to predict.
1. Email.
3-Don't publish (post) any private data.
2. Forums.
4-Avoid deleting Cyber bullying messages.
3. Instant Message.
5- Don't interview anyone you know via the internet
4. Facebook.
6- Be careful! Don't send any electronic message when you are
5. Blogger.
angry.
Thirdly: Forms of Cyber Bullying
7-Inform your parents with what annoy you when you use the
Forms of cyber bullying include:
internet.
1. Anonymity:
8-The download of software from the internet should be done
It is the use of pseudonyms (aliases) to hide e-aggressor's
under the supervision of your teacher or your parents.
identity for impunity.
2. Harassment:
It is aggressive messages directed against one or more persons.
3. Cyber stalking:
It is a form of electronic harassment where the aggressor
frequently traces and chases a particular person in all electronic
media.
7

You might also like