0% found this document useful (0 votes)
99 views40 pages

3rd Prep Language Computer Booklet - First Term 2023- 2024

Uploaded by

Nelly Daved
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)
99 views40 pages

3rd Prep Language Computer Booklet - First Term 2023- 2024

Uploaded by

Nelly Daved
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/ 40

3

PREP 3
Index
CHAPTER 1 : Problem Solving
Problem solving
 Problem solving stages
 Flow chart
 Simple flow chart
 The use of Branching (Decision) in Flowcharts.
 The use of Loop in Flowcharts.

Chapter II :Introduction to Visual Basic .Ne


 The language of Visual  Programing and computer
Basic.net memory
 The language of Visual Basic.net and Framework.net
 Visual Basic.net and IDE

Chapter III :Controls


 Form  Button
 Label  Text box
 List box  Combo box
 Group box  Radio button
 Check box

Chapter IV: Code Window


 Code Window.  Event Handler.
 Setting the (Properties) programmatically.

2 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Chapter one " Problem Solving "
 Problem definition:
Problem is a situation that requires a solution or an objective you want to achieve
through following consecutive steps sequentially.
 Problem solving:
Problem Solving is the steps, activities, and processes to be done to reach an output or
objective.
 Problem solving stages:
(1) Problem Definition
Problem definition implies the identification of required outputs, available inputs and,
arithmetic and logical operations to be executed.
(2) Algorithm Preparation
After identifying and analyzing the problem, outputs and inputs; a plan in the form of a
series of successive steps is made which is called an (Algorithm),

Algorithm: - is one of the methods used to solve a problem through logically


arranged procedures (Flowchart).
(3) Program Design
Having drawn a “Flowchart” to solve the problem, using a computer; we have to
translate this flowchart into one of the programming language
(4) Program Testing
During writing a program we unintentionally make some mistakes e.g. writing a minus
sign (-) instead of (+). We cannot detect errors unless we begin entering data to the
program with previously known results; and compare the results of the current
program to those of the well-known results and so you can discover the errors and
correct them.
(5) Documentation
This step includes writing all steps taken for solving the problem that include: given
Input, output, plan for solving the problem, drawn flowchart, programming language
used for coding , instructions, date of last modification of the program and, people who
contribute to the program development process . This is done to have the program
documented to go back for feedback and correction. This documentation is beneficial
when more than one person participates in writing or modifying the program.

3 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


 Flowchart
It is a diagram that uses standard graphical symbols to illustrate the sequence of steps
required for solving a problem or specific question.
 Some advantages of Flowcharts:
 Facilitating the reading and understanding of the problem and illustrating to the
programmer what must be done.
 Useful to explain the program to others
 helping in documenting the program in better manner, especially if the program is
complicated
 The most commonly used symbols as shown in the table:

Significance Symbol

Terminal

(input & output)

(process)

(Decision)

(Flow lines)

First: Simple Flowchart


Exercise (1):
Draw a flowchart for a program that will calculate the sum of two numbers entered
by the user and display the result.
First: Define the problem
Output: The sum of two numbers
Input: The first number is “A “and the second number is “B”
Processing (Solution): C =A+B where the result is C

4 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Second: Algorithm Third: flowchart

1- Start
Start

2- Enter A and B
Enter A and B

3- C = A + B C=A+B

4- Output C Output C

5- End
End

To construct a flowchart, we should consider the following:

1. The flowchart should start with the Start symbol and end with the End symbol.
2. A,B,C are variable names .The variable refers to a memory storage that holds a value.
3. Equation: C =A+B, indicates the sum of the value of A, to the value of B, and stores the
result in C.
4. Entering values in A and B is done by using the term “Enter”, inside a parallelogram,
like “Read” or “Input”.
5. The sum equation is written inside the rectangle, as it represents an
arithmetic operation.
6. The output is expressed with a parallelogram using the term “Output”, we
can also use another term like “Print” or "output".
7. Note that flow line shows the order of an Algorithm.

Exercise (2):
Draw a flowchart to solve a first degree equation Y=3X+2
First: Define the problem
Output: The value of Y
Input: X
Processing (Solution): Compute the value of “Y” from the equation Y=3x+2
Note
1. The left hand side (LHS) of any equation should contain only one variable; the value
of this variable will be the (output) or the solution of the equation.
2. The right hand side (RHS) of the equation may contain abstracted values or
arithmetic expressions that have one or more variables (inputs).

5 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Second: Algorithm Third: Flowchart
1- Start
Start
2- Input X

3- Y = 3*X + 2 Input X

4- Print Y
Y = 3*X + 2
5- End
Print Y

End
Exercise (3):
Write down the algorithm, and draw a flowchart to compute the area and the
perimeter of a rectangle whose length (L) and width (W) are known, bearing in mind
that the equation of the area is: Area =L*W and that of the perimeter is:
Perimeter=2*(L+W).

First: Define the problem


Output: Area and Perimeter
Input: L , W
Solution: Area = L*W, Perimeter = 2*(L+W)
Second: Algorithm Third: Flowchart

1- Start Start
2- Enter L, W
3- Area = A*W Enter L, W
Perimeter = 2*(L+W)
4- Print Area and Perimeter Area = A*W
Perimeter = 2*(L+W)
5- End

Print Area and


Perimeter

End
6 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬
Exercise (4):
Write down the algorithm, and draw a flowchart to compute the area of a circle whose
radius R is known, bearing in mind that the equation of the area of circle is:
Area=3.14*R*R.
First: Define the problem
Output: Area
Input: R
Solution: Area =3.14*R*R.
Second: Algorithm Third: Flowchart

1- Start Start

2- Enter R Enter R

3- Area = 3.14*R*R Area = 3.14*R*R

4- Print Area Print Area

5- End End
Exercise (5):
Write down the algorithm, and draw a flowchart to calculate the number of years,
bearing in mind that the number of months is known.
First: Define the problem
Output: Years
Input: Months Solution: Years = Months / 12
Second: Algorithm Third: flowchart
1- Start
Start

2- Enter Months
Enter Months

3- Years = Months / 12
Years = Months / 12

4- Print Years
Print Years
5- End

End
7 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬
Second: The use of Branching (Decision) in flowcharts
There are many problems that contain a question requires a Yes or No, or requires
branching to other processes determined by flowchart
Exercise (1):
Draw a flowchart to print the word "successful" In the case of the degree input is
greater than or equal to 50?

First: Define the problem


Output: print the word Successful
Input: the score X
Solution: If the value of X is greater than or equal 50; the word “Successful” will be
printed
Second: Algorithm Third: flowchart
1- Start
Start
2- Enter X

3- If X >= 50 Then Enter X

4-1 Print Successful

Yes
5- End X >= 50

No
Print Successful

End
Exercise (2):
Draw a flowchart for a program that will calculate the division of two numbers. if the
divisor equals (zero), the message displays " undefined".

First: Define the problem


Output: Print the result of dividing two number “R” or print the word “undefined"
Input: Numerator is “num1”, denominator is “num2”.
Solution: if num2=0 then print “undefined”, otherwise print the result of the division
“R”.
8 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬
Second: Algorithm Third: flowchart
1- Start
Start
2- Enter the Numerator num1

3- If num2 = 0 Then Enter num1

3- Print “undefined”
Enter num2
4- Go to step 7

5- R=num1/num2 True
Num2 = 0
6- Print R

7- End False
Print “undefined”

R = num1/num2

Print R

End
Exercise (3):
Draw a flowchart for a program that obtains a number from the user. Determine the
number type (even or odd) and print the result?
First: Define the problem
Output: print the number type (even or odd).
Input: the number “N”.
Solution: The even number is determined if the entered number is divisible by 2
without remainder, otherwise it will be odd
Second: Algorithm
1- Start
2- Enter N
3-If N is divisible by 2 without remainder then
3-1 Print “even number”
4- Else
4-1 Print “odd number”
5- End
9 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬
Third: flowchart

Start

Get N

Yes N No
divisible
by 2

Print even
Print odd
number
number

End
Exercise (4):
Draw a flowchart to Get a temperature degree, and print out the following result
“greater than zero" – " less than zero " –"equal zero”
First: Define the problem
Output: Print out “greater than zero” – “less than zero “or “equal zero”.
Input: Temperature degree Celsius “D”.
Solution: The temperature degree entered will be compared to zero
Second: Algorithm
1- Start
2- Enter D
3- If D = 0 Then
3-1 Print Equal 0
4- Else
4-1 If D < 0 Then
4-1-1 Print Below 0
4-2 Else
4-2-1 Print Above 0
5- End
10 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬
Third: flowchart
Start

Get D

True
D=0

False Print Equal 0


True D<0

Print Below 0 False


Print Above 0

End
Exercise (5):

Write down the Algorithm, and draw a flowchart to enter two unequal numbers , then
print " the largest is ……?" "and, " the smallest is…..?

First: Define the problem

Output: print out “the largest number is ...? “– “the smaller number is .…? “
Input: X, Y so x not equally
Solution: the X will be compared to Y
Second: Algorithm

1- Start
2- Input X,Y so x not equal y
3- If X > Y Then
3-1 Print out “the largest number is X , the smaller number is Y
4- Else
4-1 Print out “the largest number is X , the smaller number is Y
5- End

11 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Third: flowchart
Start
Input X,Y
so x not equal y

False True
X>Y

Print out “the largest


Print out “the largest number is X, the smaller
number is Y, the number is Y
smaller number is X

End
Exercise (6):
The following flowchart is used to calculate the Area of a circle with radius "R".
Redraw the flowchart so that it displays the message" not allowed" and exits from the
program (when the value of "R" is negative")

Start

Start
Enter R
Enter R
True
R<0

Area = 3.14*R*R
False Print
Not Allowed
Print Area
Area = 3.14*R*R

End
Print Area

End
12 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬
Third : The use of iterative loops in flowcharts:
Exercise (1) :

Print out the numbers from 1 to 3

First: Define the problem


Output: print numbers from 1 to 3
Input: number M
Solution: print number M and increment it by 1 then continue printing until the
value of M become greater than 3
Second: Algorithm Third: flowchart

1- Start Start

2- M=1
M=1

3- If M<=3 Then
False
M<=3
3-1 Print M
True
3-2 M=M+1 Print M

3-3 Go To step (3)


M=M+1
End
4- End
In the previous flowchart complete:
 How many times was the content of the loop executed ……… 3
4
 What will be the value of M after the end of the loop…………
Exercise (2):
Modify the flowchart of the previous exercise to print the multiplication table of No. 3
Second: Algorithm
1- Start
2- J=1
3- If J<=3 Then
3-1 Print J*3
3-2 J=J+1
3-3 Go To step (3)
4- End
13 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬
Third: flowchart
Start

J=1

False
J<=12

True

Print J*3

J=J+1
End

Exercise (3):
Print the multiplication table of any number?

Second: Algorithm Third: flowchart


Start
1- Start

2- Enter N
Enter N

3- J=1 J=1

4- If J<=3 Then

J<=12 False
4-1 Print J*N

4-2 J=J+1 True

4-3 Go To step (4) Print J*N

5- End
J=J+1
End
14 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬
Exercise (4):
Write down the Algorithm and draw a flowchart to print out even numbers from 2 to
10
Second: Algorithm Third: flowchart
1- Start Start
2- M=2
M=2
3- If M<=10 Then

3-1 Print M False


M<=10
3-2 M=M+2
True
3-3 Go To step (3) Print M

4- End
M=M+2
Exercise (5): End
Print out the sum of integer numbers from 1 to 3?
Second: Algorithm Third: flowchart
1- Start
Start

2- N = 1
3- Sum = 0 N=1

4- Sum = Sum + N
Sum = 0
5- N = N + 1
6- If N > 3 Then Sum = Sum + N
6-1 Print Sum
N=N+1
7- Else
7-1 Go to step 4
No
8- End N >3
Yes
Print Sum

End
15 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬
Exercise (6):
Redraw the flowchart of the previous exercise in your notebook after modifying it to
print out the sum of odd numbers from 1 to 10

Second: Algorithm Third: flowchart


1- Start
Start

2- N = 1
N= 1
3- Sum = 0

4- Sum = Sum + N Sum =

5- N = N + 2 Sum = Sum + N

6- If N > 10 Then
N= N+2
6-1 Print Sum
No
7- Else N > 10

7-1 Go to step 4 Yes

Print Sum
8- End

End

16 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Questions
A. Choose the appropriate answer to complete each phrase of the following:
1. Steps, activities and procedures to be done to reach an objective or an output - can
be called:
a. problem definition
b. problem
c. problem solving
2. On drawing flowcharts we use:
a. standard symbols and lines

b. all geometric figures

c. one geometric figure

3. A set of procedures arranged logically for solving a specific problem – can be


called:
a. problem
b. algorithm
c. program testing
4. Making sure that the program is free of errors – can be called:
a. program testing
b. program documentation
c. algorithm
5. Writing down all the steps taken to solve a problem errors – can be called:
a. program documentation
b. program testing
c. flowcharts
6. A schematic representation that depends on drawing some standard symbols to
clarify the order of procedures to solve a problem can be called:

a. Problem
b. algorithm
c. flowchart

17 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Chapter Two: Introduction to Visual Basic.net
The language of visual Basic .net:
It is one of the high level programming languages and designed to be easy to learn as its
commands and instructions use English language vocabulary and it can be used in
many applications such as:
1- Windows applications
2- Web applications
Programming and computer memory:
Commands and instructions which are written in Visual Basic.net enable you to create
objects in computer memory and every object has:
1- Properties such as (size-color- font) of the text written on the program interface.
2- Events such as click on a command button.
3- Procedures, each one contains commands and instructions which are carried out
when calling this procedure.
So, the Visual Basic.net is considered:
 Object oriented as its programs work through objects in computer Memory.
 Event Driven as commands and instructions are carried out as soon as certain
event occurs.
The language of visual basic .net and framework.Net:
The Framework.Net provides the following:
* Libraries through which we create the objects.
* Runtime environment (called Runtime) in computer memory where Applications
produced by the language of Visual Basic.net language work in.
* Compilers which compile commands and instructions written in Programming
language into machine code which the Computer deals with.
Visual Basic .Net IDE:
The programmer of Visual Basic.net needs Integrated Development Environment (IDE)
which provides tools and merits to the programmer that help him create applications
(windows – mobile – web…...). Visual Studio represents IDE.

18 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


1- Form:
The form is the interface which the user deals with through different controls
such as Button, Textbox, label……etc.

Form window before putting controls Form window after putting controls

2- Toolbox Window:
It contains tools of controls which can be put on the Form and
can be shown in categories in the following Figure

Some of these categories include:


1. Common Controls
2. Menus & Toolbars

19 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


3- Properties Window
Each tool of the above Common Controls has a group of properties which can
be adjusted through "Properties Window" as shown in this Figure:

Property value (right column)


Property name (left column)

4- Solution Explorer
There is a list of folders and files of the projects in this part as shown in this
Figure:

Solution
Name
Folders and
files for first First Project
project

Second Project

Folders and
files for second
project

20 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Questions
Choose the appropriate answer to complete each phrase of the following:
1. Object Oriented programming language depends on:
a- Using Windows applications
b- Using Web applications
c- Objects in computer memory
2. You can produce Windows applications or Web applications by using:
a- Objects in computer memory
b- VB.net language
c- Properties and Events
3. Characteristics which describe the object such as size, name and color are
called:
a- Properties
b- procedure
c- Events
4. Click on Button is:
a- property
b- procedure
c- Event
5. Commands and instructions which we want to carry out are called:
a- properties
b- producers
c- Events
6. The Properties term refers to:
a- Features that describe the object
b- Events that can occur to the object
c- Commands and instructions that are carried out
7. The Events term refers to:
a- Properties that describe the object.
b- Events that can occur to the object.
c- Commands and instructions that are carried out.
8. The Procedures term refers to:
a- Properties that describe the object.
b- Events that can occur to the object.
c- Commands and instructions that are carried out.
9. Libraries, Compilers and Environment of runtime of applications are the most
important components of:
a- Object Oriented.
b- Event Driven.
c- Framework.net.
10. IDE is called:
a- Visual Basic.net
b- Visual Studio.
c- Framwork.net

21 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Chapter Three: Controls
 Form
The Form has many properties which share in defining the form of program screen
we want to create.
Here are the effects of setting the previous properties on the Form:
Appearance
Property mode of Form Window after setting
Value
Name property the property
effect

The value of Name


property doesn't
In design appear on the Form
Name frmSquare
mode because it is used as
Form Name in code
window.

In design
mode and
Text ‫ﻣﺴﺎﺣﺔاﻟﻤﺮﺑﻊ‬
runtime
mode

In design
mode and
Color DarkSeaGreen
runtime
mode

In design
mode and
RightToLeft Yes
runtime
mode

22 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Appearance
Form Window after
Property Name Value mode of
setting the property
property effect

In design
RightToLeftLayout True mode and
runtime mode

In design
MaximizeBox False
mode and
MinimizeBox False
runtime mode

In design
ControlBox False mode and
runtime mode

In design Note
FormBorderStyle None mode and
the
runtime mode

In runtime The Form is Full


WindowState Maximized
mode screen

23 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Notes:

1. There are common properties among different Controls such as (Name-Text –


Forecolor – Backcolor - Right To Left…….etc.)
2. There are some properties which their effect doesn't appear on Controls until you
set some other properties , for example the Right to Left Layout property doesn't work
unless the value Right to Left equals Yes
3. There are properties of the form, if they are set, they are applied to Controls which
are placed on this Form such as font and Forecolor properties
4. The default value of the property (Text) and the property (Name) is the same and it
is (Form1)
5. When you set some properties, the effect of setting appears directly on the Form in
design mode of the program
6. There are some properties which their effect doesn't appear on the Form or
Controls until you run the program
7. The other Controls may have the same properties mentioned above, so they won't
be repeated again when we studying these other controls once more.

Here are some properties of the Form:

N Property Name Function

1 Name Name of Form used in Code Window


2 Text The appeared Text on the title bar of the Window
3 Backcolor The background color of the Form.
The direction of Controls on the form Window From Right
4 Right to Left
to Left.
Right to Left
5 The layout of Controls on the Form from right to left
layout
It controls the appearance or disappearance of
6 MinimizeBox
MinimizeBox of Form Window
It controls the appearance or disappearance of
7 MaximizeBox
MaximizeBox of Form Window
It controls the appearance or disappearance of
8 ControlBox
ControlBox of Form Window
9 FormBorderStyle The Border style of Form Window
It defines the Window State of the Form (Maximizing,
10 WindowState
Minimizing or normal)

24 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


 Button
It is one of Controls which can be placed on the Form. When you click it, it does a
certain task.
Placing the Button on the form:
By double clicking on the Button control on Toolbox, the Button appears on the
Form in Design mode as it is shown in the following Figures:

Some distinctive properties of Command Button:

Property
N Function
Name
1 Location The location of placing Button on the Form.

2 Size Defining the height and width of Button on the Form.

3 Text The appeared Text on the Button

4 BackColor Choosing the backColor of the Button.


Defining (shape ,size and style) of the Text font appeared
5 Font
on the Button.
6 ForeColor Choosing the ForeColor to the appeared Text on the Button
Note: - that when you click on the command button in the design mode:
1. Eight squares appear on the borders of the Button
2. You can change the location of Button by using the process of drag and drop after
moving the mouse pointer until it turns into a shape with four heads
3. You can change the size of the Button by using the process of drag and drop using
the pointer of the mouse through the eight squares
25 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬
Some distinctive properties of Command Button:

Appearance mode Form Window after


Property
Value of property effect setting the property
Name

In design mode and


Location 0,0
runtime mode

In design mode and


Location 98,108
runtime mode

In design mode and


Size 75,23
runtime mode

In design mode and


Size 121,62
runtime mode

Backcolor Yellow
Forecolor Blue In design mode and
runtime mode
Text ‫اﺣﺴﺐ‬

26 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Label
It is a tool used in showing a Text on the Form Window which can't be changed
during program Runtime.

Some distinctive properties of the Label:

N Property Name Function

The Size of the Label is defined automatically according


1 AutoSize
to the written Text if the Value of property equals true.

2 BorderStyle Choosing the Border Style of the Label

Note: - You can change the size of Label manually by using the process of drag and
drop when the Value of the property Auto Size is false through the eight handles in
design mode only and its effect appears in design mode and runtime mode.

Property Appearance mode Form Window after


Value
Name of property effect setting the property
Name lblResult In design mode

:‫اﻟﻨﺘﻴﺠﺔ‬
Text
Forecolor Choosing an
Backcolor appropriate color
Font Choosing an
AutoSize appropriate color In design mode and
BorderStyl Choosing the runtime mode
e Size, Style and
Type of the
appropriate Font
False
FixedSingle

Textbox
It is a tool used to insert (input) data from the user during program run time.

27 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Some distinctive properties of the Textbox:

Property
N Function
Name
It defines the maximum number of letters which can be
1 Maxlength
inserted in the TextBox
It defines a symbol used instead of written text in case
2 PasswordChar
we have a password.
3 Multiline Allows multiple lines within the text box control tool.

Here are the effects of setting some properties on TextBox :


Appearance
Property mode of Form Window after setting the
Value
Name property property
effect
Maxlength 30 In design
Password * runtime mode
Chart True
Multiline In design Letters less
mode and then 30
runtime mode
after set a Letters
value to the replaced by *
text property

Writing in
multiline

 ListBox
It shows a list of items.
Some distinctive properties of ListBox:

N Property Name Function


1 Items A group of items shown in the ListBox
2 Sorted It defines whether the elements in the list are sorted or not.
It defines whether it is possible to choose one item or more
3 selectionMode
shown in the ListBox.

28 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Here is the effect of setting some properties on the List Box:

Appearance
Property mode of Form Window after setting the
Name Value property property
effect

‫ﻋﻤﺮو‬
‫راﻣ‬ In design and
Items Names sorted
‫ﻳﺎﺳﻤﻴﻦ‬ runtime mode
‫ﺳﻤﺮ‬ alphabetically
SelectionMode Multiextended In runtime mode Select more
than one item
In design and
Sorted True
runtime mode

 ComboBox
A ComboBox control displays a drop-down list from which one item can be selected.
Some distinctive properties of the ComboBox:

N Property Name Function


1 Items A group of items which are shown in comboBox.
2 It is a source of suggested items to select from.
AutoCompleteSource
3 AutoCompleteMode It defines the method of list completing process.
Here is the effect of setting some properties on the ComboBox:
Appearance
Form Window after setting the
Property Name Value mode of
property
property effect
‫ﻣﺼﺮ‬
‫اﻟﺴﻮدان‬
‫اﻟﺼﻮﻣﺎل‬
‫اﻟﺠﺰاﺋﺮ‬
In runtime
Items ‫اﻟﻤﻐﺮب‬
mode
(Each when writing
country " ‫" اﻟـ‬the
name in countries
starting with "
single line)
‫" اﻟـ‬are
In runtime suggested
AutoCompleteMode Suggest
mode
In runtime
AutoCompleteSource ListItems
mode

29 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


 Group Box
Is used to group other controls of same function together on the Form window.
Here is the effect of setting some properties on the GroupBox:
Property Appearance mode Form Window after setting the
Value
Name of property effect property

In design mode and


Text ‫اﻟﻨﻮع‬
runtime mode

Choose
In design mode and
Forecolor the Red
runtime mode
color
In design mode and
RightToLeft yes
runtime mode

 Radio Button
The program user selects one alternative only.
Some distinctive properties of the RadioButton:

N Property Name Function

1 Checked It shows whether RadioButton has been chosen or not.


2 Text It is the Text shown on RadioButton

In case of placing a group of Radio Buttons and set the text
property to each one of them in design mode as it is shown in the
following Figure:

During program runtime, you can select one Radio Button only as
it is shown in Figure:

You can use Group Boxes such that each group has a title and
the user is allowed to choose one alternative from each group as
it is shown in the following Figure:

30 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


 One Radio Button is placed inside the Group Box by dragging the appropriate Radio
Button inside the Group Box.

 Check Box
It is used for placing some alternatives to enable the user to select one Check Box
or more as shown in Figure:

 During program runtime, you can select more than one Check Box.

Questions
Choose the correct answer to complete each statement:-
1- The function of "Right to Left" property of the Form is:
a- Define the direction of Control tools from Right to Left.
b- Define whether the layout of ControlTools on the Form is from Right to Left.
c- Define the state of the window in a state of maximaizing or minimaizing.
2- The Object TextBox is marked by one property :
a- AutoSize
b- Name
c- PasswordChart
3- The property responsible for the shape, size, and font effect of the text appearing
on the command button is:
a- backcolor.
b- forecolor.
c- font
4- You can change the position of the command button on the Form window
through the following operations except:
A- Drag and drop using the mouse.
B- Set the size property.
C- Set the Location property

31 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


5- You can change the position of the command button on the Form window by:
A- Set the Location property.
B- Set the size property.
C- The eight squares around the command button.
6- On inserting any ControlTool by pressing D-Click from the ToolBox on the Form ,
the appropriate place to be shown is :
a- Coordinate (0,0)

b- The middle of the Form

c- The position of ControlTool is different according to the size of the Form

7- The size of the Label widget is automatically determined on the form window if
the property is:
a. AutoSize = False

b. BorderStyle= FixedSingle

c. AutoSize=True

8- The size of Label is defined manually on the Form if the property is:
a- AutoSize = False

b- BorderStyle= FixedSingle

c- AutoSize=True.

9- the following properties are all for the TextBox control except the property
a- autosize

b- multiline

c- maxlenght

10- The right value which can be used to set the PasswordChart of the TextBox is :
a- Pw
b- True
c- *

32 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Code Window
Visual Basic.NET language provides a window through which we can write instructions
and codes of the program called (code window)
To open the (Code Window) of (Form1) perform the following:
1. Make sure that the window Form is ac ve
2. From the keyboard press (F7)
The Code window is displayed as shown in the following figure:

Code Window
(1) Name of the file where codes are saved
(2) Name of the file where the Form window interface is saved
(3) The declaration of Class; its name is (Form1)
(4) Space between two lines; to type codes for the Class (Form1)
(5) The end of the class (form 1)

Event Handler
It’s a procedure which contains a code that is carried out when a corresponding
event occurs.
To create Event Handler do the following steps:
1. In the (Solution Explorer) window, right click the file (Form1.vb) and, select (View
Code) from the context menu as shown in this figure:

33 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


When choosing (View Code) the following figure appears:

(1) A drop-down menu of (Class Names) that displays the names of controls on the
form.
(2) A drop-down menu of (Method Names) or events; associated with the item
selected from the (Class Names) menu.

2. Open (Class Name) menu and note that the default names of the controls are
listed as shown in this figure.
3. When you select (Button1) from the Class menu drop down list, open (Method
name) menu it displays the events associated with (Button1).
4. Choose the required event from the drop-down menu (Event handler).

Event Handler

34 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


(1) The procedure name composed of (object name, event name).
(2) End of procedure line.
(3) ) What causes the call of the procedure (event occurrence) .
(4) Between the two lines shown; the code that will be executed on calling the
procedure is written after the occurrence of the (Event).
(5) The declaration of the class line (frmSquare).
(6) The end of (class) line.

Adjust the property (Name) for the following controls as shown in table:

No Control Value of the property(Name)


1 Button1 btnCalculate
2 Label1 lblLength
3 Label2 lblResult
4 TextBox1 TextBox1

 After setting the properties, select (Code) from (view) menu.


 Open the (Class) menu and note that the displayed names of the controls have
been changed as shown in the following figure:

Setting the (Properties) programmatically


In chapter 3, we have already set the properties through properties window.
You can adjust the properties using the following syntax:
CONTROLNAME. PROPERTY = VALUE

The control or The


The value
the object name property

35 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬


Setting the (Properties) programmatically
Example:

Write the following code in the appropriate event handler (Bu on1_Click) for bu on1:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Label1.Text =" ‫" ﺟﻣﮭورﯾﺔﻣﺻراﻟﻌرﺑﯾﺔ‬

End Sub

When the event occurs, formwindow appears, as shown in a figure:

Question
1. Explain the components of the general syntax to adjust the properties of controls
programmatically:
ControlName.Property = Value

2. Explain the following codes through your pervious study for the general syntax to
adjust the properties of control programmatically :
(A) Bu on2.Text = "END"
……………………………………………………………………
(B) Label1.AutoSize = True
……………………………………………………………………
36 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬
‫‪Model‬‬
‫‪Answer‬‬

‫‪37‬‬ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ ‪ /‬ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ ‪ .‬ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬


LESSON 1
Choose the appropriate answer to complete each phrase of the following:
1. Steps, activities and procedures to be done to reach an objective or an output -
can be called:
a. problem definition
b. problem
c. problem solving
2. On drawing flowcharts we use:
a. standard symbols and lines
b. all geometric figures
c. one geometric figure
3. A set of procedures arranged logically for solving a specific problem – can be
called:
a. problem
b. algorithm
c. program testing
4. Making sure that the program is free of errors – can be called:
a. program testing
b. program documentation
c. algorithm
5. Writing down all the steps taken to solve a problem errors – can be called:
a. program documentation
b. program testing
c. flowcharts
6. A schematic representation that depends on drawing some standard symbols to
clarify the order of procedures to solve a problem can be called:
a. Problem
b. algorithm
c. flowchart
LESSON 2
Choose the appropriate answer to complete each phrase of the following:
1. Object Oriented programming language depends on:
d- Using Windows applications
e- Using Web applications
f- Objects in computer memory
2. You can produce Windows applications or Web applications by using:
d- Objects in computer memory
e- VB.net language
f- Properties and Events
3. Characteristics which describe the object such as size, name and color are called:
d- Properties
e- procedure
f- Events
4. Click on Button is:
d- property
38 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬
e- procedure
f- Event
5. Commands and instructions which we want to carry out are called:
d- properties
e- producers
f- Events
6. The Properties term refers to:
d- Features that describe the object
e- Events that can occur to the object
f- Commands and instructions that are carried out
7. The Events term refers to:
d- Properties that describe the object.
e- Events that can occur to the object.
f- Commands and instructions that are carried out.
8. The Procedures term refers to:
d- Properties that describe the object.
e- Events that can occur to the object.
f- Commands and instructions that are carried out.
9. Libraries, Compilers and Environment of runtime of applications are the most
important components of:
d- Object Oriented.
e- Event Driven.
f- Framework.net.
10. IDE is called:
d- Visual Basic.net
e- Visual Studio.
f- Framwork.net
LESSON 3
Choose the correct answer to complete each statement:-
1- The function of "Right to Left" property of the Form is:
a- Define the direction of Control tools from Right to Left.
b- Define whether the layout of ControlTools on the Form is from Right to Left.
c- Define the state of the window in a state of maximaizing or minimaizing.
2- The Object TextBox is marked by one property :
d- AutoSize
e- Name
f- PasswordChart
3- The property responsible for the shape, size, and font effect of the text appearing
on the command button is:
a- backcolor.
b- forecolor.
c- font
4- You can change the position of the command button on the Form window
through the following operations except:
A- Drag and drop using the mouse.
B- Set the size property.
39 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬
C- Set the Location property
5- You can change the position of the command button on the Form window by:
A- Set the Location property.
B- Set the size property.
C- The eight squares around the command button.
6- On inserting any ControlTool by pressing D-Click from the ToolBox on the Form ,
the appropriate place to be shown is :
d- Coordinate (0,0)
e- The middle of the Form
f- The position of ControlTool is different according to the size of the Form
7- The size of the Label widget is automatically determined on the form window if
the property is:
d. AutoSize = False
e. BorderStyle= FixedSingle
f. AutoSize=True
8- The size of Label is defined manually on the Form if the property is:
d- AutoSize = False
e- BorderStyle= FixedSingle
f- AutoSize=True.
9- the following properties are all for the TextBox control except the property
d- autosize
e- multiline
f- maxlenght
10- The right value which can be used to set the PasswordChart of the TextBox is :
d- Pw
e- True
f- *
LESSON 4
1. Explain the components of the general syntax to adjust the properties of controls
programmatically:
ControlName.Property = Value
CONTROL NAME
PROPERTY VALUE

2. Explain the following codes through your pervious study for the general syntax to
adjust the properties of control programmatically :
(A) Bu on2.Text = "END"
…………………… Show the word End on the face of the button tool………………………
(B) Label1.AutoSize = True
Zoom in and out of the Title widget according to the size of the text displayed in it
40 ‫ ﻳﺎﲰﲔ ﺷﻌﻴﺐ‬. ‫ ﺟﺮﻭﺏ ﻓﺮﻳﻖ ﺃﺻﺪﻗﺎء ﺍﻟﻜﻤﺒﻴﻮﺗﺮ – ﺃ‬/ ‫ﺇﻋﺪﺍﺩ ﻭﺗﺼﻤﻴﻢ‬

You might also like