You are on page 1of 54

1

)
( )(byte


) (byte



***********************************************



) (

3 ) 3 (


single

Byte

char
date
boolean
Short
double
string
Integer
decimal
Long
**************************************************

Byte
Short
Integer

0 255
1
32768
2
32767
-
4
3

)
(

5
10

Long

single

double
decimal

8
16

char

string

date

boolean



2147483648

2147483647

2147483647
38
3810 1
0
38
10


0
2

1/1/0001
31/12/9999
True or False
yes or No

)
(

19
7
15
29




200
byte ,short , integer , long
byte


321456.15478961 417
decimal , single , double
4

single


321456.2 :
double
321456.154789614
decimal
321456.15478961417
**************************************************


:


:
vb.net
vb.net


- :




syntax error

*********************************************

as Const

=

-1
-2
***********************************************
:


Dim

as

*******************************************



vb.net

)( syntax error
-1
captal small
-2
_ underscore

-3

.........
-4
vb.net )( double,date,dim,const






first name :

FristName
frist_name
underscore


frist
integer
Intfrist
***********************************************




:
-1
-2
-3

Dim a as integer
Dim b as integer=20
dim
a
b 20

Dim a as string
"Dim b as string= "sama

a ""
b ""sama
"" "
"

"
"" "
)
(
***********************************************


Dim


a,b
integer
c,d
string
1- Dim a as integer
Dim b as integer
Dim c as string
Dim d as string
Dim a,b as integer
Dim c,d as string

2-

3-Dim a,b as integer , c,d as string




.....
*******************************************


) (




=
8

=
=
=
A = 10
A = 10

10 A
A
10
=
=


:
Dim a as integer
a = mohamed

a

a=7

A=41-

a = 2 , b = 5
- 2

a = b

) (
) (
a
b
a
b

******************************

-3
a = 4, b = 7
a = b + 2
9

) (
) (
b
a
b

3 2 =
=

=

: X + 1 = 3

=
X = x + 1


x 1+
*******************************************

-1 =
-
-
-2 =
*****************************************



10











&

:
""& "number

" & ""number of student" = "of student

*****************************************




)
( .
123
123
123 123

11



text
) (textbox
text



textbox

......

parse

.................
.......................
parse

(Integer.parse

(Decimal.parse
*********************************************


textbox




label
textbox

Tostring

Tostring

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

)).Tostring
try/catch

textbox
................




12

try/catch

try/catch


*******************************************
try/catch
Try

Catch


End try
)""(Msgbox


Dim first, second, result As Decimal
13

first = Decimal.Parse(TextBox1.Text)
second = Decimal.Parse(TextBox2.Text)
result = first + second
Label4.Text = result.ToString
End Sub


try
Dim first, second, result As Decimal
try
first =Decimal.Parse(TextBox1.Text)
second =Decimal.Parse(TextBox2.Text)
catch
msgbox(")"
End try
result = first + second
Label4.Text = result.ToString
End Sub

`

vb.net

/

\

Mod

^


14



=41/4

=41/4
10

mod 4 = 1 41
^
)(
double

vb.net




vb.net









)
(

*************************************************

)3*5+1-2/4^2*2+3(
15

3+2*4/4-1+5*3
3+8/4-1+15
3+2-1+15
5-1+15
20-1
19
)(

4\2^3*1+2
2+1*9\4
2+1*2
2+2
4

***********************************************

) (
:




)
) ( to
( from
byte
Short,integer,long,single,double,or
decimal
short
Integr,long,single,double,or decimal
integer Long,single,double,or decimal
long
Single,double,or decimal
16

decimal Single or double


Single
double
:

-1 Double

-2
Double,Single Decimal

: a
integer b decimal
a=b
:

************************************************



double

:











17




:





vb.net ) ( class
) ( convert
) ( methods to


Toint16
Short
Toint32
Integer
Long
Toint 64
Todecimal
Decimal
Tosingle
Single
Todouble
Double
:
x
single y decimal
:
)Y = convert.Todecimal(x
-2 x
double y integer
y=convert.toint32(x) :
*************************************************

18


:
-1

convert
transfer
parse -
implicit -
-2 " " vb )
(
-3
) ( integer
) ( string
( dim n1,n2,n3 as integer, dim s1,s2 as string
( dim n1,n1,n3 as integr
Dim s1,s2 as string
( dim n1 as integer
Dim n2 as integer
Dim n3 as integer
Dim s1 as sting
Dim s2 as string
( (

( ( (

-1

) (

19

-2 integer division
)\(

-3 =
) (

-4 ) ( dim

-5 string
) ( (tostring

-6 )
(



Dim number1 as integer
) Number1=(4*3^2)/(10 mod 3 -1

)Number1=(4*9)/(1-1
Number1=36/0
: mod 3=1 10

*********************************************

:

:

:
Const Pi As Single = 3.14
20

Dim R As Single
Dim Area As Double
R = 1000
Area = Pi * R * R
) Msgbox ( Area
-1 R ............
............
-2 ............
Single
............
-3 ..................
..................

.................. .Pi * R^2


-4 R Dim
Pi
..................

:
-1
-2
-3
-4
-5
-6
-7

0
255
) .( Byte Integer String
) ( Boolean Byte Short
True .False

).(Integer Short Single

).(Integer Double Single




) - (.
) ( Dim Const End
.
) ( Sub Const Dim
.

21

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



.
-9 4 * 3 + 2 )
.( 9 20 14
-10 2^3 +1 ) 16 10
.( 9
:
:
( ( Dim , Const , String , Single
-1

Single .................
-2 ...................
.
-3 ...................
.
) ( )(
:
-1
-2
-3
-4
-5
-6


"".
)(.....

"".
)(.....
Integer 0
.255
)(.....
Byte 0
.255
)(.....
Boolean True .False
)(.....

Integer .Short
)(.....
22

-7
Single .Double
)(.....
-8
.
)(.....
-9 Dim Integer Double
.
)(.....
-10 Dim
.
)(.....
-11 Constant
.
)(.....
-12 Try/Catch
.
)(.....
-13
.
)(.....
-14
.
)(.....
-15
.
)(.....

23



:
.

true

false

< >
>< => =<

( (If Then..Else
)
(
true false
(( if then else
If
then )(condition
) (statment1
(
Else
24

) Statment2
(

End if

then else
then
else
****************************************************

vb.net
:
-7 ( ( file ) new
( project create project
-8 windows
) ( project type ) ( templates
windows application
-9

: form
-1 form
-2


properties
view

properties window



)
(
25





form

textbox label
f5

debug start


debug stop

Public Class Form1


Private Sub Button2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
Dim first, second, result As Decimal
)first = Decimal.Parse(TextBox1.Text
)second = Decimal.Parse(TextBox2.Text
If second = 0 Then
)" "(MsgBox
Else
result = first / second
Label3.Text = result.ToString
26

End If
End Sub
End Class

try / catch

Public Class Form1
Private Sub Button2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
Dim first, second, result As Decimal
Try
first = Decimal.Parse(TextBox1.Text)
second = Decimal.Parse(TextBox2.Text)
Catch
MsgBox(")"
End Try
If second = 0 Then
MsgBox(")"
Else
result = first / second
Label3.Text = result.ToString
End If
End Sub

**************************************************
( If Then )

27

) (
) (


then )If (condition

End if
then
End if

********************************************************
If .. Then Else
then If 1
1
then Else if 2
2
then Else if 3
4
..............
....................
....................
Else
N
End if


true

true else
Else
true
end if
****************************************************
28

) ( string
vb.net



vb



*****************************************************

ANSI code
: ANSI code
-2
5 60-59
*****************************************************



: hala > 45123
: hala >45123 True
4 h h
4
*****************************************************

A ,B ,CZ
65,66,76..................................90
a , b , c,..z
97,9899.......................................122
small
capital
29

: true
false
""NEHAD"<"NEHAL
: N
N
D,L
ANSI code L 76
D 68 True
"salah salem"<"salah" -2

s salah
32 s 115
false
if check box radio button group
box
radio button


Name

BackColor

Appearance
button

Checked

Enabled


Forecolor

Height

Image
30

Text
Visible
Width

check box


radio button
group box


text group box

Name
Flat Style

Enabled
Text
Visible



) system( flat
,popup ,standard







Radiobutton1

Radiobutton2
31

Public Class Form1


Private Sub RadioButton2_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RadioButton2.CheckedChanged
Me.BackColor = Color.Green
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RadioButton1.CheckedChanged
Me.BackColor = Color.Red
End Sub

Me name form


:
-1 ifthen..else ) ( end if

-2
)If (condition
)d d
Msgbox("n is divisible by
.
n
End if
d
n

) 0= ( n mod d

-3 checked check box

-4 check box :


: ) ( )(

)(
-1 >

-2 > =

-3 <

)
)
)
)
)

(
(
(
(
(
32

)(

.
.
.
.


-4 <=

-5 ><

-6 =

) (

: A 20 B
15
) ( ) ( X
.
-1 A>B .TRUE
-2 A>=B .FALSE
-3 B<A .TRUE
-4 B<=A .FALSE
- A<>B .FALSE
- A-B>B .TRUE
- A-5<=B .TRUE
: :
..=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
33

) (
) (
) (
)
)
)
)

(
(
(
(

) (
) ( X :
.1 A=92
) (
) (
.2 A=49
.3 A=77
) (
) (
.4 A=88
.5 A=70
) (
) (
.6 A=30
) (
.7 A=55
.8 A=90
) (
:
:
) ( RadioButton - CheckBox - GroupBox Checked Enabled - CheckedOn
.1
.2
.3
.4
.5

.............. . CheckBox
..............
.
..............
.
..............
.
.............. .

34

: :
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
) (
) ( X .
Arabic . 30
.1
) (
English .22
.2
) (
Arabic>25 .TRUE
.3
) (
Total . 47
.4
) (
Avg .23.5
.5
) (
.6
: :
Age=25.5
Mark=90
If Age<26 Then
Age=16
Mark=100
End If
Total=Mark*2
.
-1 Age:
16 -
90 -
25.5 -
-2 Mark:
25.5-
100 -
90
-3 : Age<26
35

False-

True -
25.5
-4 Total:
190-

180 -

200





Do while loop

Do while condition
Statement 1

Statement 2
Statement3
.......
36

........
........
Statement n
loop


- True


loop
loop do while
true

False

.......

_ False
loop.
do while

Loop

**************************************************
: 1 5
do while

button1
Button1

37


1 5
x=x+1
x=x+2
0 5
x=1 x=0
x=x+1 x=x+2
**************************************************
: 1

textbox


:

38

final

parse

x
do while loop
x
x=x+1

label3.text=sum.Tostring
label3 label1
label2


x=x+1 x=x+2
x=1
x=0
x=x+1 x=x+2

for Next
do while

Fornext
)For counter = start to end (step increment
statment1
statment2
statment3

..
..

Statement n
for next
Next
: Counter
39

: Start

: End
: Increment
counter

-1 start counter
-2 counter end
_

)( for , next
-

next
-3 : next(
counter increment
step

(

1 5
for..next


Dim x as integer
For x= 1 to 5
)Msgbox(x
Next
for..next
do while..loop
: 1 5
Dim x as integer
For x = 1 to 5 step 2
40

5 1

)Msgbox(x
Next

Dim x as integer
For x = 5 to 1 step -2
)Msgbox(x
Next
for

1 10
Dim x , sum as integer
Sum=0
For x = 1 to 10
sum=sum +x
Next
Label1.text=sum
label1
Label1.text=sum next
loop


: sum=0
x , sum

listbox
listbox



41


,


vb

Name

Horizonatalscrollbar

Items

Selecteditems

Sorted


items


items
method items
listbox
behavior
method
text
)Add( text

text
) Insert ( index ,text

index

Count

text
) Remove ( text
42


)Removeat (index
index

Clear

Index ) (
count -1 count
listbox
listbox

4
3

3 listbox1

)"Listbox1.items.add("2

3 listbox1

)"Listbox1.items.insert(1,"3

5 listbox1
)"Listbox1.items.remove("5

listbox1
)Listbox1.items.removeat(2

listbox1
( )Listbox1.items.clear

listbox1
Listbox1.items.count


:
43

-1 ) do while..loop
( true
-2
do while..loop :
-3
) ( counter
listbox ) ( method
clear :
-5 ) ( method
listbox in add :
:

Sum=0
Count=0
)Do while ( x<10
Sum=sum
Count=count+1
Loop
Average =sum/count


x


:
x=x+1


Sum=0
Count=0
)Do while ( x<10
x =x+1
Sum=sum +x
Count=count+1
Loop
Average =sum/count



For i=1 to 10 step x
44

)Msgbox(i
Next

x
9
18
36


-1
-2
-3
1
3 , 2 , 1
1-



3
1

:

x =4.5
I
For I = 0 to 7 step 3
0
x =x*2
3
Next
6
x x = x*2

: for...next do
while....loop
I =1
For i= 1 to 10
do while I <=10
)Msgbox(i*i
)Msgbox(i*i
Next
I=I+1
Loop

For I =0 to 7
If ( I mod 2=0) then
)Msgbox(I+1
Else if ( I mod 3=0) then
) Msgbox( I*I
Else if ( I mod 5=0) then
45

1
1
3

)Msgbox(i+1
)Msgbox(i
)Msgbox(I+1

)Msgbox(2*i-1
Else
)Msgbox(i
End if
Next
i

I mod 2=0
1
Else
2
I mod 2=0

) Msgbox( I*I

I mod 3=0

5
9

)Msgbox(i+1
)Msgbox(2*i-1

I mod 2=0
I mod 5=0

4
5

7
7

)Msgbox(i+1
)Msgbox(i

I mod 2=0
else

6
7


) ( )(
:
-1 Do while .loop false
( ) .loop
-2 Do while .loop true
( ) .
-3 Do while .loop
( ) .false
-4 Do while .loop
( ) .true
-5 Do while .loop ( ) .
-6 For..next ( ) .
46

-7 For..next
( ) .
-8 for i=2 to 10 step 2 ( ) .5
-9 Listbox
( ) .
10
( ) .Listbox
-11 Listbox ( ) .
:
-1 Do while .loop true
- .
- .
- .
-2 for i=1 to 6 step 2
3 -
4 -
6 -
-3 ListBox
counter -
count-
selecteditems -
-4 Do while .loop
true -
false -
nothing -
-5 ) RemoveAt ( index ListBox
-
-
-
-6 ) Insert ( Index ,text ListBox
-

-

47

:
) False ) - True - Insert ( Index ,text -
solution explorer (
-1 Do while .loop
.loop
-2 Do while .loop .
-3 Do while .loop
.
-4 Listbox
.
-5 ) Insert ( Index ,text ListBox .
-6 for I = 4 to 10 step 2 .
)
) (
-1
) Insert ( Index ,text
-1
-2
count
-2
-3

selecteditem

-3

-4

)RemoveAt ( index

-4
-5

( ) (
) (
.ListBox

.ListBox

.ListBox
.ListBox

.ListBox

) ( ) (
.for next
-1
ForNext
-1

-2
Do while loop
-2
.

-3

-3
.
-4

-4
.
Do while
-5
.loop

48

-1 interval timer 3000 :


30 -2
3 -1
300 -4
3000 -3


tick
:
- 1 8
1. total = total + i
)2. MessageBox.Show(total
3. Next
4. For i = 1 To 8 Step 2
5. Dim i, total As Integer
- 1 8
Loop
Do While i <= 8
Dim i = 1, total As Integer
)MessageBox.Show(total
total = total + i
i = i + 2

1.
2.
3.
4.
5.
6.


) ( timer
timer

timer


49


enable true
false

false
interval
timer
tick
tick

interval 65535
= 1000
timer enable false
Tick
data time
date vb.net
date time

date time


now


date

dayofyear

hour

minute
50


second

year

month

day

x date
Dim x As Date
x= now
)Msgbox (x



Dim x As Date
" x= " 25 2 2009
) Msgbox (x .Year

2009

Dim x As Date
" K = " 25 2 2009
) Msgbox (x .Month

2
Dim x As Date
" K = " 25 2 2009
) Msgbox (x .Day

25

Dim x As Date
" x= " 25 2 2009
)Msgbox (x.DayOfYear
56
Dim x As Date
" x= " 9 : 35: 10
)Msgbox (x.Hour
9
Dim x As Date
" x= " 9 : 35: 10
)Msgbox (x.Minute
51

35
Dim x As Date
" x= " 9 : 35: 10
)Msgbox (x.Second
10

2009-2-25

Dim x As Date
" x= " 25 2 2009
)Msgbox (x .date




date


AddDays

) (
AddHours

AddMinutes ) (


x date
Dim x As Date
"x= " 12-4-2008
))Msgbox (x.AddDays(4
2008-4-16
Dim x As Date
"x= " 12-4-2008
))Msgbox (x.AddDays(-2
2008-4-10
52

Dim x As Date
x= " 12-4-2008"
Msgbox (x.AddDays(-2))
2008-4-10

Dim x As Date
x= " 12-4-2008"
Msgbox (x.AddHours(-24))
2008-4-11
Dim x As Date
x= " 12-4-2008"
Msgbox (x.AddHour (24))
2008-4-13
Dim x As Date
x= " 12:25:35"
Msgbox (x.AddHour (2))
14:25:35
Dim x As Date
x= " 12:25:35"
Msgbox (x.AddHour (-2))
10:25:35


53

............ ........ 1-
) (
........... 2-
) ( 3-
............
.... ....... 4-
............... ...............


............. 1500
= 1000
= 1500
.............................


tick
interval enabled
true

-2 interval timer 3000


:
30 -2
3 -1
300 -4
3000 -3



tick

Ramadan_family2008@yahoo.com

54

You might also like