You are on page 1of 30

:

() () :
-1 .

-2 .Dim

-4 Double Decimal Single (.

-3 Double true .False

-5 .Textbox

-7 " " .

-9 integer 0 .225

-6 Dim .Variables

-8 "".
-11 Byte 0 .225

-11 Boolean true .False

-12 integer .Short

(
(

)
)

-13 single .Double

-15 Dim integer Double .

-17 .

-14 .
-16 Dim .

-18 .

.sum + run = 50 -21

-19 .

.Dim Price as Decimal = 110 -21

)
)
)
)

.58 mod 7 = 2 -22

-25 .

(
(

-26 .

(. )Dim , double, integer, const

-29 .Dim

-23 .

-24 .Disks

-27 ( )integer & Long & Short

)
)

-28 ( )reserved words Visual Basic

-31 ( )2+3*5 .25

-31 Double .

-32 .

-34 Decimal .

-33 Try/catch .

-35 ( ( MsgBox )5 + 3 ^2 / )8 mod 5 . 8

-36 Decimal & Single & Double (.

-37 .

-38 .

(
(

-39 String .

-41 Spent-Money ( .
-41
.

: :

-1 0 225 .

()string integer Byte

-2 ( )short Byte Boolean true .False

-3 ()Single Short Integer

-4 Single Double (.
)integer

-5

( )

-6 ( )End Const Dim .


-7 2 + 3*4 (. )9 20 14
-8 1 + 3^2 (. )9 20 14

-9 5+2*(3+7)/5 : - 12 5 14 ( : )

-11 :
( )

-11 ( )Const/As Dim/As Try/Catch


.

-12 (. )String Single Catch

-13 (. )Const Dim Age


-14 (. )Total As- Age

-15 (. )Single Boolean String


-16 :Constants

(
)

()5 14 16

-17 . 2 (7 + 2) * 2

: :

-1 .
-2 .

-3 .

: :
-1 ............... ......... .
-2 ................. .

-3 ......... ...............

-4 () .......... ...........
-5 .....................

-6 Single
..............

-7 ......... .

-8 ........... .

:) )Label (1
:
Dim intNum As integer = 10
intNum = intNum + 2
intNum = intNum Mod 3
Label 1.text = intNum
()4 1 3

) :

(5 + 3 ) * 2 )1

2 (7 + 2) * 2 )3

16 + 5 10 / (2 + 3) )5

5 + 3 * 2 )2
(3 + 7) / 2 + 3 / 6 * 2)4
15 / 9 ^0.5 / 3 )6

: :
Dim X, Y , Z As integer
X=2
Y=3
Z=4
)MagBox (Y^X*X+Z*3
..................................................... :

:
) :

:
.............................. -1
.............................. -2
.............................. -3
.............................. -4
.............................. -5
) :

Dim R As Single
Const X As Single = 3.14
Label 1 . text = X*R^2

.........................................................................................................
.........................................................................................................

) :

Din X As single
Const X As single x = 10
) :

............................................ -1 ................................................. -2

:)

........................................................................................................ -1

........................................................................................................ -2

........................................................................................................ -3

) :

: :
.......) (.....
..........) (.....

.....) (.....

(..

)........

: :

: :
Noor Belal
Belal Noor
Belal
A * B = 63
7 * 9 = 63
7*9=A*B

Dim strName A String = "Belal"


StrName = '' '' & StrNamr
StrName = "Noor" & StrName
Label1.text = StrName
Dim A As integer = 7
Dim B As integer = 9
Msgbox (A & " * " & B & " = " & A " B

: () ()
:
-1 If Then .Else .2

-2 Else If .true
-3 & .

-4 OR False
(

. False

-5 Select .. Case ( .

)
)
)

-6 X 15 y 350 < 10 and y > 500

x False

-7 Else .If

(
)

-8 And true (.true

-11 Select ... Case .

-9 Listbox .Selectindex

)
)

-11 X= 5 Y = 7 X <= 5 and Y > = 7


(

.False

-12 IF .. Then .. Else If .

)
(

-14 If A < B and B < C Then true c = 2 B = 5 ( .A = 3

-13 Select Case .


-15 Then if.then ( .False

-16 ( ) X< = 3 and y<10 true .

(
)

-17 A 20 B 15 A < = B ( .true


-18 ( )A and B ( )true A ( .true B

)
)

: () () :
()

()
1

>

= >

3
5
6

()

()

= <

()
()

<

<>

()

()

: A 02 B 51
() () :
-1 A<B .True

-2 A<=B .False

-4 => B .False

-3 B >A .True

-5 A>< B .False

-7 A-5>=B .true

-9 B<B .true

-6 A-B<B .True

-8 A>A .true

-11 A-5< = B .true

)
)

: :
Age = 25.5
Mark = 90
If Age>26 Then
Age = 16
Mark = 100
End If
Total = Mark*2

:
-1 Age :
16 -

25.5 -

90 -

90 -

100 -

25.5 -

25.5 -

true -

False -

200 -

180 -

190 -

-2 Mark :
-3 : Age>26

-4 Total :

-5 x, y, j, k, z x=8, y = 2, j=3, k = 4 :

z :

6 -

7 -

If x < y and J > k Then


Z=xy
Else
Z=j+k
End If

8 -

-6 ( )M or N .............

(M N M N M N )

11

: :
A = 50
B = 30

: True False

-1 A = 50 or B <10 ................
-2 A=50 And B = 10 ..............
-3 Not B<10 ........................

-4 A = 50 And B = 30 ...............
-5 A = 20 OR B<10 .................

: :

A = ..
If A < =90 Then
'''' MsgBox
End If
If A> 90 And A < = 75 Then
'' '' MsgBox
End If
If A > 75 And A <=50 Then
"" MsgBox
End If
If A > 50 Then

"" MsgBox
End If
() () :

-1 A = 29 .

-3 A = 77 .

-2 A = 49 .

11

-4 A = 88 .

-5 A = 70 .

-6 A = 30 .
-7 A = 55 .

-8

A = 90 .

)
)

: :
Arabic = 30
English = 20
If Arabic < 25 Then
Total = Arabic + English
Avg=(Arabic + English)/2
Else
Arabic = 25
English = 22
Total = Arabic + English
Avg = (Arabic + English)/2
End If

() ()
:
-1 Arabic .30

-2 English .22

-3 Arabic<25 .True

-5 Avg .23.5

-4 total .47

: :

)
)
A = 35
B = 70
C = 21
If A < B then
AA= A/B+C
BB = (B-C)/2
Else

12

AA=B/A+C
BB=(A+B+C)/6
End if

:
-1 .............................. . AA
-2 ............................. BB

-3 A>B And B<C ...........................

-4 B>C Or A<B ...............................

: Label 1
Textbox1
Dim Deg As Short
Deg = textbox 1.text
SelectCase Deg
Case 85 To 100
" '' = Label1.text
Case 75 To 84
" '' = Label 1.text
Case 65 To 74
" " = Label 1.text
Case 50 To 64
"" = Label 1.text
Case 0 To 49
"" = Label 1.text
Case Else
" Label 1.text = "111
End Select

13

31
84
6444
33
11443

: Y = 3x +2
" "
.
Dim X,Y As single
X = Textbix 1.text
Y=3*X+2
Label 1.text = y

Dim Num As integer = 10


If Num <=10 then
"Label 1.text = "two
Else
"Label1.text = "Three
End If
Dim A As integer = 15
If A mod 3 = 0 Then
"Label1.text = ''True
Else
"Label1.text = "False
End If

14

One
Two
Three

True
False
15

Dim x As integer = 2. Y As integer = 3. Z As integer = 4


If X = y and X > < Z Then
Label 1. text = "First"
Else lf X = y OR X >< Z Then
Label1.text = "Second"
Else If X > < y and X>< Z Then
Label1.text = "Third"
Else
Label1.text = "forth"
End If

First
Second
Forth

: :
: 8 True Select -1

Case is < =4 -

Case 1 to 6.8 -

Case is > 8 -

: Select Case :
Dim x As integer x = Me.textbox1.text
If x = 0 Than label 1.text = ""
End If If x < 0 Then

Label 1.Text = " "


End If

: :
If x > Y then
Z=K+J
X=x+1
Y=Y1
Else
Z=KY
X=Y2
End If

y = 2 K = 1 J = 1 x = 0

X
Y
Z

15

: () ()
:

-1 " Msgbox "3" & "*" & "3 .9

-2 M For M = 3 To 1 step-1 .

-3 Step for....Next .
-4 2500 interval Timer 2.5.

(
(

.
-5 Do While
-6 Do While Loop False (.Loop

-7 Do While Loop True .


-8 Do While Loop .False

-11 Do While . Loop .

-9 Do While .. Loop .True


-11 For Next .

(
(

)
)
)
)
)
)
)

-12 For Next


-13 5 . For 1 = 2 To 10 Step 2 Next

(
(

-14 Do While . Loop .

-15 Loop Do While Loop ) (.True


-16 Do While Loop While
.True

-17 For . Next


For .

-18 For . Next .

16

)
(

-19 Do While Loop .False

: :

-5 Do While Loop : True


-

-
- .

-0 For N = 1 to 6 step 2 Next :

3 -

5 -

4 -

-3 Do While Loop :
Nothing -

True -

false -

-4 .......... Do While .. Loop

- )False

-1 Do While Loop :

- .True
- .true

- . False

-6 Next .. For Next

- .

- .
- .

-7 :

Do While -

Select Case -

For .. Next -

17

-8 Text1
2 -

Dim Y as integer
For Y = 2 to 10 step 2
Text 1.text = Text 1.text & Y
Next

246811 -

2345678911 -

-9 Label1 :
11 -

Dim Y as integer =10


Do While Y > 10
Y = Y +1
Loop
Label1.text = Y
Next

11-
1 -

-52 Label1 :
5 -

Dim I as integer, Sum As integer


For I = 1 to 5
Sum = Sum + I
Next

11 -
15-

Label 1.text = Sum

-55 :Label1
2 -

Dim I as integer
For I = 2 to 10 step 2

2,3,4,5,6,7,8,9,10 -

"Label 1.text = ibiOut .Text & I & ",


Next

2,4,6,8,10 -

-50 A=2 :
Do while (a=2) -

Do While )a>2( or )a < =2( -


Do while )a><2( -

-13 :

18

Dim J As Byte
For J=1 to 500 step 3
)ListBox 1.Items.Add(J
Loop
- Do .. While For Next

- .

-54 For M = 10 to 1 step-2 : M


- .

- .

-51 :
Dim N As integer
Dim S As integer
For N = 1 to 100
S=S+N
Next
Label1. Text = S

111 : 1

- . 111 : 1

- 111 : 1

-56 A >< 0 :
Do While (a = 2) -
DO while )a > 2( or )a <=2 ( -
Do While ) a >< 2( -

: :
- 1 8
(..) Total = Total + i
)(..) MsgBox (Total
(..) Next
(..) for I = 1 to 8 Step 2
(..) Dim I, Total As integer

19

- 1 8 :
(..) Loop
(..) Do While I 8
(..) Dim I = 1, total As integer
)(..) MsgBox (Total
(..) Total = Total + i
(..) I = I + 2
- 1 10 :
(..) Loop
(..) Do While I 10
)(..) MsgBox(i
(..) I = I + 1

: :

Sum :
12 -

35 -

22 -

21

Dim count, Sum As Integer


Count = 1
Sum = 0
Do While Count 10
Sum = Sum + count
Count = count + 3
Loop
)MsgBox (Sum

: R :
)(0.5 1 1.5

Dim R As Single = 0.5


Do While R > 1
R = R + 0.5
)MsgBox (R
Dim R As integer = 1
Do While R < =1
R=R2
Loop
)MsgBox (R
Dim R, Sum As integer
For R = 5 to 10 step 1
Sum = Sum + R
Next
)MsgBox (R

)(Overflow 2 0

)(10 5 0

: :
( False insert (index, text) - True )

-1 Do While Loop ............ . Loop


-2 Do While Loop .... .

-3 Do While Loop ..... .


-4 for 1 = 4 to 10 step 2 ................

: () () :
For Next -1

-1 for next

Do While . Loop -2

-2

-3

-3

-4

-4 .
-5 Do While .loop

21

: :
Dim N, K, C As integer
C=6
For N = 1 To 6 Step 3
K=K=N
Next
If N >= C Then
C=C+1
End If

:
-1 C ......................

-2 N ......................

-3 N>=C .................
-4 K .................. :

: :

Dim X,C As integer


X=4
For C = 0 To 7 Step 3
X = X*2
Next
)MsgBox (X
X ....................................................

22

: :
Privet Sub Button1-click
Dim X As String
Dim degree, Arabic, eng, math As Decimial
Dim I As integer
For I = 1 to 4
)X = inpuBox (inter your name
)Arabic = inpuBox (Arabic
)Eng = inputBox (English
)Math = inputBox (math
Degree = Arabic + eng + math
TextBox1.Text = degree
TextBox2.Text = x
Next
End Sub
End Class

:
X

Math

22 Ahmed
24 Ramy
25
Dody
30 Mema

Eng
20
34
35
43

Arabic

TextBox2
TextBox
..
..
.. ..
.. ..
.. ..

12
13
16
54

: () ()
:
-1 .

-2 Timer .
-3 Timer .

-5 Click Timer .Timer

-4 interval .Timer
-6 interval .

23

(
(

)
)
)
)
)

-7 Timer Enabled . Flase

-8 Enabled .
-9 Timer .

(
(

: :

-1 interval Timer 3111 :

3 -

3111 -

31 -

311 -

-2 Timer Timer1 Enabled = .....

End -

False -

True -

interval -

Enabled -

Modifiers -

-3 interval Timer Tick ...........


-4 Timer ........... . False

24

-
Tag -

)
)

: () ()
:
-1 procedure .

-2 Predefined .

-3 Area Single .

-4 Parameters Procedure .Procedure


-5 SUB Function

-6 SUB Function .

-7 Procedures .parameters

)
)

-8 Procedure Variable Constant


. Function

-9 .

-11 IsNumeric True .False

: () ():

()

Sub

Function

variables

Constants

()


.

.

25

: Function Sub :
)(
Function XX (ByVal fn as string, ByVal in as string) as string
Dim Fname S string
Fname = fn + + in
Return fname
End Function
)(
Sub ss ( )
Messagebox.show(2*(7+2)-2)
End sub
)(
Sub Show odd or Even (ByVal Start As nteger)
Dim I As integer
Label1.text =
For I = Start to 10 step 2
Label1.text = label1.text & & i
Next
End sub
)(
Function Area (By Val R As single) As Single
Const X Single = 22/7
Dim Area As single
Res = X*R^2
Return Res
End function
)(
Label 1.text = isNumeric ( Five )

26

Add Sum ) ( :
:
X = Y + AddSum -
AddSum ( ) = x + y -
X = AddSum ( ) -

: :

Public Class From 1


Function Sum (ByVal First As Single, ByVal Second As Single) As Single
Dim Total As Single
Total = First + Second
Return total
End Function
End Class
............... -2
.................... -1
: -4

................... -3

............ -

........................... -

................... -

: :
Function Area (ByVal R As Single) As Single
Const X As Single = 22/7
Dim Area As single
Res = X*R^2
Return Res
End function
............... -2

.................... -1

: -4

................... -3

............ -

........................... -

Sub Show odd or Even (ByVal Start As nteger)


Dim I As integer
Label1.text =

27

................... -

For I = Start to 10 step 2


Label1.text = label1.text & & i
Next
End sub
-1

-2 .

: Function :
) )Mesagebox.Show (Factorial (5

: :
Function Calc (ByVal Fn As single, ByVal sn As Single) As Single
Dim res As Single
Res = Fn + Sn
Return res
End Function
-2 ...............
-1 ....................
-3 ...................

- ...........................

-4 :

- ............

- ...................

28

-1 .

-2
-3 .

(
(

-4 .

-5 .

(
(

-6 .

-7 .
-8 .

: :
-1 :
. - .

-2 :
URL-

. -

-3 :

- .

. - .

-4 :

. - .

- .

29

)
)
)

:
:
. - .

- .

- .

- .

(
(

- .

- .

: :
. - .

. - .

(
)

-1 .

-3 .

-4 .

: () ()

-2 .

)
)

-5 .

: .
: :
-1

-2

31

You might also like