Csharp Advanced

Download as pdf or txt
Download as pdf or txt
You are on page 1of 238

"#$% !

67 4 5
( = 9

4 ( 012 + 3
<*

'

=* > - + <*

D 12 6 E ==+ D
= 7 +4
K
HF

9 C + = -;

-* . + / ( : 3

. + / ( D
D(

67 K O

+ /-; :

94 8 (

> - 2 @A B ? 6 =2

5 9 C + G 2 H I 4 * = -;

: ==+ D
( 3=

,-+ . + / & ' ( ) *

= 9
. +&

' 6 (
NF A

. +/
<*

9 C +

M9 F 3

4 JI

6'

:3
S =+ ,

D - /

> KR

K !=

8F A

LF
0 P

K Q

AF

Tel : T%"U"VT%"TU
;X

\ = 6 =2

+D

D
*3

= 4*3
67 G

+[ 6 L

W ( . + / NF A
'

D +

W
M9 * 3

L=

67 Y 7
:3

S3 !

"T::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::^

#
(

"

!
' % $ % &"
)! *+

./

) ,-

./

for ,-

.(

for ,- 0 " 1+

34

" 2+

33

while ,-

3
3

do while ,IF ) 5!

36

Else if

3#

Switch

3(

) 7

Math
8 9

8 9:

foreach ,64
6

=*<
>

?$ > )

63
6/
6
#4
#6
#/
#
/
/.

" ) @AB
CD

>):
>! E

@AB

Get set
=!F G ?$ 0 " 1+
I !F H
I+ J
Dialogs

Timer

System.Collections

) ?7+

!+?B

((

System.Drawing

! K9 L0 "!<

M F !H
DLL

Threading

> P

>0

"!OFN I, F

Q F"2
Q F R"!B
#

>0

? T+

PS

MD5T+

PS

.
.3

"!OF

Q F R"!B F U

.6

sysytem.io > ) @AB

.(

UserControl

3.

"#V:::::::::::::::::::::::::::::::::::::::::::::::::::::
3#
3(

:::::: ^D

D ' ]G

V B
V B & + "

"U":::::::::

::::::^_

4 ! 1+]G

System.Data.OleDb

OleDbConnection

OleDbCommand

WXY

OleDbDataAdapter

WXZ

DataTable

WX[

"" P < >!

66

>! H L H

##
#(

LINQ to SQL

/6

sql server )!2

"`%::::::::::::::::::::::::::::::::::::::::::

:::::::::::^ASP.NET]G !E J

(
(.
(

!<

asp
)

\ & 1]

html > ) !+?B


Table
Validation

.4

MasterPage

.4
. .
. 3
. 6
. /

Navigation
.

SiteMapPath
FileUpload
AJAX

^ObjectDataSourceNSQL " " P <

.36

) B B

.3/

8 !

67 4

9 +

3 E

( ) * +
: <=+

< =+

6 -=*[

X / -*

9 C +4

+ ;
L=

L -2 D O /
==+

=+

^K 21d ]

X 4

b
>
=

67 ( D

= * <* 8
94 8 (

!
K

+
<

J9 &(
! 9

+ <

<* >

<* >

9 C +6 (<

L 3
= 3

G + 1b 3 K

* +/ Ge

= 3

a0 K

67 3

4*

==+

? G G

? 3I

! 7 c 89

-2^ ' 4 * BI ]

? 3I

4 * 6 ( <* * ? G / /

6 (/

73

L=

9 C + 4 ? 3I 4 W2 L=

4 * 6 ( - ( < =+
. +/

><

< -! ?

/ -*

6 (
+

1b <

- 4

=E

>4*

6 =2
5

67(

9 C +4

9 C +6 (/

- 9 9 C +6 (
<

\ 9 8 O 4

'E

< =+ 4(
L

7B

<(
b <(

9 C +f 9
D O

! 7(
^

<

6 (/

X 8F

+D

:^<

4 : ==+

>4*
6 9

6 (

NF A

< * > = 7 9 C + ? 3I 4 W2

< =+

JI
= 7

8F ]:D

D'
!

`
^ c !<N
!`H

)
` ?B !`

% S " BN ?

G S >!

+_ %
%C _ "

I;

"!B ! de

! >!
?B

)O

! 0 = B !) >
" B

> c !<
)" = 2

> "

^ b Qa N !2?< ?B

! M ,B

"!B B A _ C

?B " 2 " d > ! >


BG

%C _ 0

c !< +
9

^%

"

^ b Qa N
^.b Qa N ?B \ f+

%C _ 0

c !< M " 2 > !

^.b N
"

"2

c !< 9 ?B M ,B

" #$$ %

> ! ^3b Qa N

1] G "

a F !H

> "T

! @"
`

`S "!`B T ) `d

` "

"

"T

)
B

" " \ `- G `

+`

M` ,B ' CB" >


B
`

,`]

" B=

)O

S 0 !+O = "

d !H

?B M ,B

)" ! *9

S "!B T ) d B
`

" " S

" " !_ T ?B " 1+

"

" 2 2; "

` "!B " `2 > `

I ;0 %

!_ B

#$$ %

!+I ! B %

a F !H & 19 T+

>

"

#$$ %

2?H R; " a F !H & a

! > ! %D!

" #$$ %

"

" #$$ %

&

?B " 1+ R; 0

B +-

"
!

) R;

1`] G > ) T+ ; !P " "

gU 9G

` ! " Qa` !` 0 " %


?B

` ! > !`

` > ` > `) %C `_ "

B T?B

d T " ;

+a G

! ^3b Qa N

+S

1] R C) " h -

! B >!

?B \ f+

" d

!+O \ +B G " "

"2 >

! 9

` !
!

+_ %
,] =!F

" "
G " ^ b Qa N

^ b N

>

! M ,B

"!a

)O

!H + S " " !_ )

i$ %C _ "

h %C _ " (
B

?B

)O

gU 9 >

> ) %C _ "

R" " !_ > ! "! H


G C)
!_

1,+f > ) !+?B )


)

G 0 = B !)

!_ =!F G >

! )

CB" M R" " !_ > ! A7


fS" R a "

"!B 2
$ $

" )" j C

I;

%C _ 0

" " d > ! >"!F

B " " !_

)" !_ =!F >

!P " !2?< !)

" " !_
"!B %

!
Oa
1] "
M ,B

!K ?

,] =!F T)

!2?< G
H

>

+_
!

= B!)

" "" T ) d

I ; % F B =!F >
>

! )

?B QCD k 9!9
9

G ?lC) )"

)" ! *9

CB" G+

%C _ " A7

)" ! *9

"!B

)O

R; ) H

6b

)" ! *9
RO ) H

! *9

C ^6b Qa N %
B

" D > ) CB" ?B

" " !_ =!F >

%C _0
! k 9!9

G C) T

B\ -G

) CB" G ! %O< > ) B S

)"

R; % F )% '
= B!) % !+I )

? ; R;

T) d

+_ 0 ?
=2

B>
" A7

?B "

B"

"

" 1+

! &

R; m

!+O

? ; >!

GS T

? ; I;

? ; !+O

QCD G !) n " B %
& 1+

!_ !P " > )

%C _ 0

G C)
9

U 9 > ! !+O

)"

OF

R; 1 n

G 0 %)
!H

"

" 1+ o !H " 2

! " ! K9 j C > !

G 0 $ *

R"!B "

> ! A7 "

" 1+ % =0h B 9 DAp R

d R"!B "

>!

G 0
" D

I;

! B B"

" 1+ ! B

>" I j < > ) ? H \ f+ > !

G 0 + '

! 0 Qa

"

G 9

! >! R 0

+S "
B R;

" 1+

" 1+ q 9 \ f+

j C >!

G 0 "

!+?B G

B % !C 9 kS

> ) !+?B 0

G 0 "

! M

B %C _ " a, ?+

_" !) "

Q7 M F !H > " )

?B \ f+

+&%

!%

a r ("

) f !H A7

?B

s T ?B

+a

!C 9 !+?B G C) Q7 "
%d "!< T ) d IS 7 " I ;

gU 9
T 0 "!<

T "!B

I; 0
B

s
!

B " TI > )
" I ; 0 " 1+

I?

, B G+

>!

` ! =!F >
` !

S "
9

"

a F hQ
G

!+ " > ! B %

`a? = `2 ` ^#b Qa` N


[2]

"!B

)O

, _ %C _ " B

! > ! >!P "


"!B %

View code

: !

St

> "

M ,B !P " @AB !)

%C _ G "

/b Qa

#b Qa
F U u!F j < & ]
%

FU

" `

) @AB ) ) G " %

u!F j < & ]

O` F `U ) ) C) B T?B

` f +B R `C) ` ) `) G %
` f +B G` 0 >

C (b Qa "

) B"

FU

9M
B ?a

+a G
FU

?B

+ S T ?B
" O

) O /b Qa

)O

" B t C)

! > ) ) h %C _ "
" 1+

I; 0

" 1+ !+O I ;0

! de dll Q F Qd "

) ) /b Qa

FU

! "

CD B
!

B" "
) ) a,
>)

`I ; `,d " > `) @A`B `)

f +B G

" QK1

>

> ) %C _ " B ?a

)O

"!B T ) d v

(b Qa

!`_.net frameworkQ`d " !`P " > )


+`

0 ` %B!

`) ` f +B G` G+d `

9 )

f +B

f +B G

f +B G [1]

!P " > ) jf " + S

?B

) O (b Qa " B

+ "

!+ " I ;

+d

" 1+` R;0 R C ` ! " T 0 ` dll Q` F M` R " d > ! T +

t C)

B !P

" B +- > !

P$ B G %

"" g U 9
T ?B

Net framework
' % $ % &"
`?B ` !`
`

kK C !9 w B >

visual studio

! % & " !H G ! ? )"

9 B
!_

! B % >c S ?a9 % & "

+d "

0 "

>)

f +B

Q` D T+ `
" " `

` +

!P " C

` ! xp Q7 Q D T+

T+ ` M > !
!` Q` B

!H G ! ?

` %` F!n > "

-"

% I;

?) f !

C >)

A7 "

; j < C >!

!_

+
!

! G

)"

!_

9 !H

+d " % & "

kK

! >)R 0

R; H

S "

!C) M 9 9

B T

? ;

L0 "

?B

9 C

! R; !P "

>)

0 % " ) f

f +B R $ % G <

> ) Q D T+

"T 9

P$ T ?
"

& + " !+O R $ % R ; I ; > !

xdQ D

! >)0

! Q F B % G % &" >

Q D T+

+d " Q D T+

% & " >c S ?a9

> ! T ?B T

c,c++

! B%

R; %

)"

kK TS D T+

`+ ` ! G+`

! B % ? ! G %,D VaD! " O C ! Win7 vista Q D T+

`) QaO G !P " "

T "!H!

M ">

! R C) Q D T+

"!`B ! *9 Q D T+
" `

! B% G % ">) H

" % &"

! R 0 & + "
"

! >! H"

"

? ;

r )! *+ 3b
`
`

+a G

) f Q w B

T ?B
! T

QCD b Qa
P

9 " 9

" > OD

O G !H "
9

B"

T+d ^ ;N
+

{ } % AD " Qd "

g ] " D y ! 9 >!
" & + " C) B T?B
> ) B C) G ?lC)

!` *+ M` y` ! 9 > !` A7` T

? "AB; " G =!F @AB Qd "


T ?B

R C ) B % F B B G+

QCD ! 0 4b Qa z t !P " > )! *+

>!

g ]" D: 0

4b
! Qd "

!) " ? =!F @AB > ! ?+ )

T) d ? ;8 9 >

CD & ]

> IOf " BN 8 9 Qd "

) ! *+ G !H

?+

" 1+

! *+

)"

S T ?B " 1+

)! *+

I; 0 T 9

" 1+ Q _ 8 9 0 { d !P " T ?B y ! 9 ^

R; 0 T ) f 8 9 Qd " +_ T ?B y ! 9 ^ , N 8 9 Qd " a
?a

y ! 9 h Qa " B

! *+

CD a = ?C) ! *+ " !H r +a
% S

T ?B " 1+ ! *+

r )"
" D " CB" OF

!_ VB % a9 "

B )" !_

! =!F >

%C `_0 ` ` ?B M` ,B ` " CB" >


M` ,B " `
0 @ `
" `

+`

! % F B CB"

BG "

`+_ " ` !

"
N"

> ! ?B 8C T)

! Event

"

! r 7

CB" M % F B B G > !

" " OF CB" G

^% 8 9 M "

" D " B>

& ,CD G R"!B


>

d !`H A7 "

8C

! VB % a9 M

`9 ` ?B M ,B
`+_

?B

+_

properties

? "

d !F CB"

! > B"

+ "! CB" >

!) n ! 0 B "!B !

M ,B

private void button1_Click(object sender, EventArgs e)


{
}

)"

T ?B y ! 9 ! *+ 9 " % F B " D " R"!B 8C > ! "

!_ VB % a9 Qd "

! *+

T )" !_ =

! *+ Qd "

!~

|} " Qd " ) B

\!U

8C Q] -

T ?B

r! 0 B Q7 T )"
private void button1_Click(object sender, EventArgs e)
{
int i = 5;
int j = 7;
int add = i + j;
textBox1.Text = add.ToString();
}

?B ) O

y,+f > ) ! *+
!_ T

Q] - 9 ?B M ,B CB" >

" R $ T ?B

"

! 9 ?B M ,B

" 1+ ToString() 0 string

9 C VaD! ^ )!+B B 0 > S "N string "

int A7 T )"

int :

F5

Q 9 > ! r +a

!_ !P a " T 9 C
T )"
rChar

T ?B

QCD k 9!9 G

" !+B B y ! 9 > !


char i = 'a';
char j = 'z';

r 7
private void button1_Click(object sender, EventArgs e)
{
char i = 'a';
textBox1.Text = i.ToString();
}

r String
r 7 T ?B

" 1+ m? !+ 0 T ?B y ! 9

"

private void button1_Click(object sender, EventArgs e)


{
string i = "Computer";
textBox1.Text = i;
}

> +

T ) f !H

T ?B " 1+ ToString() 0 %
r 7 g ] " D Q7 R"!B 8C

=0h !P " % m? !+ : 0 VB % a9 Text R $ r +a


% I ; R" " !_ T) ?B " > ?

m? !+ R"!B 8C r +a

private void button1_Click(object sender, EventArgs e)


{
string i = "Computer";
string j = "My : ";
textBox1.Text = j + i;
}

Qa

m? !+
^ m .3 %

+ S N r T ?B
,~

" 1+

& ]G

Convert

0 )! *+ !P " int

!H .3Q7

m? !+ Q 9 > ! r +a

" D R C )!+a9 B ?

int

"

int mynumber = Convert.ToInt32("123");


double mynumber2 = Convert.ToDouble("33.43");
Int64 mynum = Convert.ToInt64("9223372036854775807");
string str = Convert.ToString(123);
textBox1.Text = mynum.ToString();

%K R 9

B M$ B g ] " D

" % F!n TC B int64 " A7 % I ; % F!n " int,int32,int64 & 19 r +a


! "

+_

B % ? % & 1+
T ?B

F - "

g ]" D :

!$ a? Q S"

>!+O > sF >" f !$ "!B T ) d

G > ! ' )" !_ =


!H

VB % a9 "

)" ! *9 \!U
b Qa Q7

CB" text +

?B \!U
d !H

I;
)" !_

)" ! *9 = " " D

" D

+F!H VB % a9 " 0

" D "r 7

1] " CB" M VB % a9
I ; text

" " !_ Label 9

?B M ,B \!U CB" >

b
?

!0 B

private void button1_Click(object sender, EventArgs e)


{
int num1 = Convert.ToInt32(textBox1.Text);
int num2 = Convert.ToInt32(textBox2.Text);
textBox3.Text = (num1 * num2).ToString();
}

?B QCD

Q 9 >!

9 >!

! G C)

int num1 = int.Parse(textBox1.Text);

rT

private void button1_Click(object sender, EventArgs e)


{
int num1 = int.Parse(textBox1.Text);
int num2 = int.Parse(textBox2.Text);
double d3=(double)num1/num2;
textBox3.Text = d3.ToString();
}

string.Format

"

"" j C

OD T_

"

OD " D

d !H r +a

r ?B " 1+ & ]
int num1 = int.Parse(textBox1.Text);
int num2 = int.Parse(textBox2.Text);
double d3=(double)num1/num2;
textBox3.Text = string.Format("{0:0.000}", d3);

" " j C % F!n TC B

TC ?

"" : :

!0

Min

Max

- ..33/.43#(6 //6(4(

..33/.43#(6 //6(4(

Int64

bE+383 4.(.3

E+383 4.(.3

float

bE+308 / /# 3 3 (#.3.

E+308 / /# 3 3 (#.3.

double

a
true
b3./#/

z
false
3./#/

char
bool
Int16

b. / (3# (

. / (3# /

Int32 Int

.6#

byte

"

pictureBox:
T ?9
0

fS"

properties

R; 0

)" !_ =!F " pictureBox M

%C _ 0 a?

a " ""

! =!F " VaD M R" " !_ > !

" pictureBox " VaD R" " !_ > !

VaD

import

?B

BackgroundImage

?B

)" ! *9 Stretch
)

VaD !

BackgroundImageLayout

?B QCD Qa G

B z !p 0

pictureBox1.BackgroundImage = Image.FromFile(@"c:\cat.jpg");

?B " 1+ @"\ & ]

\\ & ]

?a fO

a,

!P "

?B " 1+

)" !_

9 C

I?9

\ % AD 0

! Q F ?B "

VaD +

" r +a

d !H

pictureBox1.BackgroundImage = Image.FromFile("cat.jpg");

)" !_ R !P "

+d "

R;

+ "

"!

Q F Debug bin

" " !_ R 9" d B

I, F

<

.exe
T)

!+ " R + !

F ; C ""

<0

! Q F

" !B " 2

B" ""

d !H GCU "
! B >!

F U Q F ?$

"

fO

VaD Q7

"!

r ) ,- b
R 9

) ,- 0 " 1+

" 1+

BG

?+ )

?B 8C T)

T)

for

,- T 0 "!w R;

! "
) 9M " D

"!a y ! 9 int 9
T) d

"

,- G S

d" "

kS

d !H A7 %

) ,- !H

S "! H

?+ ) & 1+

> ) %C _ 0 ) ,-

dM "
=2

" )

,- "!B

% ! 0 Qa & ]

?B
h

R; & + " "

" !H A7 N"

!1] i S

:!

2B 0

2? " ^ O !

|} Qd "
,- B T ?B
6

M !
fO
,- T "!a

+ "R

!) " "
+ B% & ]G
" 1+ 6 " D 0 !1]

) ,- 0
8C

,- y ! 9

] ,- G
,- "!B B

i )"

>

FU i

- M G! ? %

! *9 M

FU i
!

h-

- M !P "
]

)"

,-

!_! 5!
""!P !

M G! ? %

,- G ! ?
!_ VB % a9 "

" %
Q] -

B ?
?B

?B

& + "

] 0 !+a$ B M
!_! 5!
?B

? %

5! "
,- Qd " "

"!B

,- "

) 9M " D !0

T ?B " 1+

?B

!_! 5! T)0 "

0 9 BG "

8C T)

,- %

?B

! r 7 "

,- Qd " " T 9

i 0 r +a

private void button1_Click(object sender, EventArgs e)


{
int sum = 0;
for (int i = 0; i < 1000; i++)
{
sum = sum + i;
}
textBox1.Text = sum.ToString();
//1+2+3+4+5+....+999
}

R; !P " T

B !) > ,

% AD G

+_ T ?B " 1+ % AD 0

! &

U 9 > ! r +B
) f !

=!F > ! R; 0 !+?B M T O ? ; ListBox !+?B

,-! !) "

r )" ! *9 Qa G
int sum = 0;
for (int i = 0; i < 1000; i++)
{
listBox1.Items.Add(sum);
sum = sum + i;
}
textBox1.Text = sum.ToString();

8C Q] - a? > !
h

)" !_

y" M "

R; T "!B F U R;
T+

M
BG

!) B % & ] G
)

T "!B C " 1+

VB % S "!B B
) ,- 0 !H "! H

!_

listBox1.Items.Add(0);

listBox1.Items.Add(999);

r ?B !

)" ! *9 Qa G

Bh-

int sum = 0;
for (int i = 0; i < 1000; i++)
{
= "+sum);
listBox1.Items.Add("Sum
sum = sum + i;
}
textBox1.Text = sum.ToString();

r C1 VB % S

R; & 19 9

!0 B

)" !_

int sum = 0;
for (int i = 0; i < 1000; i++)
{
listBox1.Items.Add("Sum
= "+sum);
comboBox1.Items.Add("Sum
= " + sum);
sum = sum + i;
}
textBox1.Text = sum.ToString();

1] "

comboBox

'T) =2
9

?B M ,B =!F >

"

"

)"

2+
!_

VB % S M " B T
1] " VB % S M

) d

=!F B ?B

r! 0 B Q7 T ?B

!<

) +

! M T) d

VB % a9 M

"

G "

VB % S

"

r 7

a? > !

d !F =!F Load"
" S ) d

=!F +_ G ! ?

private void Form1_Load(object sender, EventArgs e)


{
listBox1.Items.Add("nader");
listBox1.Items.Add("omid");
listBox1.Items.Add("masoud");
listBox1.Items.Add("amir");
listBox1.Items.Add("arman")
}

)O A_ B

t C) "

T ?B M ,B CB" >
! *9

R;

T ?B "

! B

d !F

TextChanged"

VB % a9 "
r

0"

R; T "!B

>

B"

TextChanged"

?B M ,B VB % a9 >
d !F
!

CB" M ,B "
0

TextChanged

R " "

" !F

"

! 0 B h - \ d T )"

private void textBox1_TextChanged(object sender, EventArgs e)


{
listBox1.SelectedIndex = listBox1.FindString(textBox1.Text);
}

!<

?B "

a!+B B !H A7

\ f+ !+B B G " " GaC

"!B "

?B "
T)

!+B B M VB % a9 "

?B !

!+B B G " !H % a R;

=
"

!
B ?B

u D VB % S

?B " 1+ R; 0 "
%C _ 0 R; >

! "

" " %OH! C > !


G
r! 0 Qa

?B

\ f+ VB % S " B

d !F > !

?B " 1+

? "

" 2 C >! "

r"! H

>!K?D +

SelectedValueChanged

"

d !H
0

G 9 ?B M ,B VB % S "

!_ VB % a9 M "

f+ >!K?D ! 0 B "

private void listBox1_SelectedValueChanged(object sender, EventArgs


e)
{
textBox2.Text = listBox1.SelectedItem.ToString();
}

"

Q B

" " j C = " VB % a9 " 9 ?B M ,B I 0

,d "

,-

,- "

M >!

>0

a >

,- G

?B !

"r 9 " 9>)

,-

" O
r 7 r

private void button1_Click(object sender, EventArgs e)


{
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
listBox1.Items.Add("test i="+i+" j="+j);
}
}
}

" d ,d " & + "


"G! ? "
"

Q B

"
p

,- B % & ] G
B % yn

?+ )

,- M

4 4 ,- G QB " " O !
)"

"
,d "

"

,d "

,-

+ " R; !H

% 9 C,B

9 " 9 ,- 0 !+CB R + )

?B y ! 9

?B u!F

- ?B

M !)

" ,d " ,- , ,- Qd "

j C " d "

h p > ! R 0 > " R $ ?B " 1+

0 { d int y ! 9N r ?+ ) T) "

BL

] VB % S G ! ?

! " ?B

!0 & ]

,- GCU "
^ ,-

int i, j;
for ( i = 0; i < 10; i++)
{
for ( j = 0; j < 10; j++)
{
listBox1.Items.Add("test
}
}

i="+i+"

j="+j);

QCD

& ]

> ) B 0 >"

9 "

i+=2

" ; T)

"

! ! " %B!- = H A7

!0

" i+=1 %

)" ! *9
"

R +B!- = H

i++

"

d !H

t C)

?B

r%
I+=1
I-=1
I+=N

I++
I--

I=I+1
I=I-1
I=I+N

I*=N

I=I*N

I/=N

I=I/N

I-=N

I=I-N
9

rQ7

" D !) "

? T) VaD!

) ,-

for ( i = 10; i > 0; i--)

% & ]G

R; y ! 9

% While ,- T O ? ; R; T ) d

B>

,- G "

while (true)
{
}

|} Qd " " %B!- = H 2? "


L

G C) T) )

!
r T ?B

"

" B"
Q- L

,-

^trueN% " + !< Qd " & D B

!
G C)

% I
,_

int i = 0;
while (i<100)
{
listBox1.Items.Add("test");
i++;
}

,-

?a

B G !H "

! G !+I R CIF > ! "

09
c
" 1+

"

" 1+ break
r 7 T ?B

QCD L

+ "0
G C)

{ d ,- 0
R !

! 0

,- 0

" +

64 ! ! i +_

d !H

,- !) " r +a

d !H

7 G C) " A7

int i = 0;
while (i<100)
{
listBox1.Items.Add("test");
i++;
if (i == 50)
{
break;
}
}

"" T) d gU 9
,- Q7

,- G

"

B L

! 5!

%
"

I; >

%C _ " B T

,- T 0 "!w R;

do while
! do Qd " B

! ) 5!

T) d

0 ?) + S

B >!P "

,-! !) " B & 19 G

,-

% while

do
{
} while (true);

private void button1_Click(object sender, EventArgs e)


{
int i = 0;
do
{
listBox1.Items.Add(i);
i++;
} while (i < 3);
}

r IF ) 5! 6b
>
!+H

5! > !

" A7 T ?B
"

" 1+ if

" 1+ >

+ "0

?B

" % AD 0 >

CD

p!

9 5! > !

! "

d !H

?B !+?B 5!

" 1+ % AD " 0 >

!+a$ B

>

!+H

% % 7 " D ; B )" fO9

% AD " 0 !+a$ B

" 1+ % AD 0 > !

"
' 1?

>!

VB % a9 0

" D B

"
! r 7

private void button1_Click(object sender, EventArgs e)


{
int i = Convert.ToInt32(textBox1.Text);
if (i < 0)
{
textBox2.Text = "
";
}
if (i > 0)
{
textBox2.Text = "
";
}
if (i == 0)
{
textBox2.Text = "
! " #
";
}
}

%D!

a?

)"

=2

5! 2B !) L

" T ?B
T ?B

R; " % " = B !) "


" 1+
Q- L

^else ifN!P " L


G C)

7 "

! ) 5!
0
C >

a L

G ! ? G <" ;
5! !

private void button1_Click(object sender, EventArgs e)


{
int i = Convert.ToInt32(textBox1.Text);
if (i < 0)
{
textBox2.Text = "
";
}
else if (i > 0)
{
textBox2.Text = "
";
}
else if (i == 0)

!P "

"
!
!_!

{
textBox2.Text = "#

! "

";

}
}

, R; B

!_! 5!

2B !) B %

$switchN

"
' )"

!_ = " VB % a9 "

I;

F "

+ " else if
{ d break

?B

%F "

"

+ "

" D B>

?B
! r 7

private void button1_Click(object sender, EventArgs e)


{
int i = Convert.ToInt32(textBox1.Text);
switch (i)
{
case 0:
textBox2.Text = "! "";
break;
case 1:
textBox2.Text = "% ";
break;
case 3:
textBox2.Text = " ";
break;
default:
textBox2.Text = "('& ) *";
break;
}
}

0 = B ) R"

!_! & ] " B

?B " 1+

+ " "
"

0 + !< Qd " !H
g ]" D

Q 9R

: R C) 0 T) case Q
h

m? !+ : 0

default

default

9
Qd "

d !H

+ " ) 5!

D !) + !< Qd " & D r +a


T) + !< Qd " & D

m? !+ :
rT )"

private void button1_Click(object sender, EventArgs e)


{
// int i = Convert.ToInt32(textBox1.Text);
string str = textBox1.Text;
switch (str)
{
case "0":
textBox2.Text = "! "";

! *9

break;
case "1":
textBox2.Text
break;
case "3":
textBox2.Text
break;
case "hello":
textBox2.Text
break;
default:
textBox2.Text
break;

= "% ";
= "

";

= ")+ ";

= ")

* ('&";

}
}

rT

? T 9

! 0 z !p

switch

+ !< Qd " + S

switch (textBox1.Text)

>!

) =2

QCD G ,R;
"

" D

"

+F 1+9 G

A7

?B M$ R C)

" 1+ ^ N And > ! 0


" D !H

C_ M9

5!

?$

^ NOR > ! & AD 0


" !1] G

private void button1_Click(object sender, EventArgs e)


{
int i = Convert.ToInt32(textBox1.Text);
if (i > 0 && i < 10)
{
textBox2.Text = "%, -. ";
}
else if (i == 100 || i == 200)
{
textBox2.Text = "
, "";
}
else
{
textBox2.Text = "
";
}

d !H
a?

" D !H r 7
'%

9 ]

T ?B

" 1+ L

G 0 644" D yS f A7

$ M yS f

" D T P !H

If(i!=500){
}
r

? ;& + "G
' )"

!+I 9 T 0 "!<

fO9

" D

7 > ?$
TC B

B>

!0 "
!b

int a, b, c, max;
a = int.Parse(textBox1.Text);
b = int.Parse(textBox2.Text);
c = int.Parse(textBox3.Text);
max = a;
if (b > max)
{
max = b;
}
if (c > max)
{
max = c;
}
textBox4.Text = max;

r )" fO9
private
{
int
x =
for
{

R; R" Q B

+F!H >"

void button1_Click(object sender, EventArgs e)


x, i, sum = 0;
int.Parse(textBox1.Text);
(i = 2; i <= x; i++)
if (x % i == 0)
{
sum = sum + (x / i);
}

}
if (sum == x)
textBox2.Text = "#
else

";

" D M b.

textBox2.Text = "#

/' ";

}
. 3

3 4 !3 %

-/. 5

r )" j C

3 4 !3 /
#

R; VaD!

+F!H >"

+ 2
8# 0

01
8

" D M b3

private void button1_Click(object sender, EventArgs e)


{
int num, x = 0;
string str = "";
num = int.Parse(textBox1.Text);
while (num != 0)
{
x = num % 10;
num = num / 10;
str += x;
}
textBox2.Text = str;
}

r )" !_ VB % S M "

?+

! < jf " ! B

>" D

) 9 !1] G b

private void button1_Click(object sender, EventArgs e)


{
for (int i = 0; i < 1000; i++)
{
if (i % 2 != 0)
listBox1.Items.Add(i);
}
}

r )" fO9 ?

v,7 M > sD ? + I ; !H

" D

private void button1_Click(object sender, EventArgs e)


{
float a, b, c;
a = float.Parse(textBox1.Text);

B>

! b6

b = float.Parse(textBox2.Text);
c = float.Parse(textBox3.Text);
if (a + b > c && a + c > b && b + c > a)
textBox9.Text = "OK";
else
textBox9.Text = "NO";
}

?B " 1+ > OD " D > !


r" ;

= "

" S"

T) float 0 r +a
>) O

B>

! b#

+B F

! b/

private void button1_Click(object sender, EventArgs e)


{
double x1, x2, delta, A, B, C;
A = double.Parse(textBox1.Text);
B = double.Parse(textBox2.Text);
C = double.Parse(textBox3.Text);
delta = B * B - (4 * A * C);
if (delta > 0)
{
x1 = (-B + Math.Sqrt(delta)) / 2 * A;
x2 = (-B - Math.Sqrt(delta)) / 2 * A;
textBox4.Text = ("x1= " + x1 + " x2= " + x2);
}
if (delta < 0)
textBox4.Text = " :
#
";
}

rQ
int i, n, factoriel = 1;
n = int.Parse(textBox1.Text);
for (i = 1; i <= n; i++)
{
factoriel = factoriel * i;
}
textBox2.Text = factoriel.ToString();

r Math 1-6
@ ?

A7

?B " 1+

I; 0

B" ""
r

;%

8 90

" DM R 9

s @AB G "

@ ?

\ 9 `g"

r
!P "
!)

9 R;

d !F fO =

?B \ - R C !

u!F A7 % >
0

" DM Q
>

" = B !) S
Q

8 9

+B F 8 9
M

+B F B T

> " 8 9 )"


?)"

=2

? 9

F ??B Q

+B F

B R; 8 9

%OH!
"! P

>

8 9,

: !
T+

9T 9

A7 % 0 & ] " 8 9

QCD G T "!B

""

"Q

d !F

1] " CB" " B

+B F \ -

??B

d !F

a; R

?$ !)

+B F QCD B T

=2

+B F 8 9 G C) " A7

" y,+f :

8 9 s

"!H!

) % GaC

I 9:

gU 9

! 0 " ) %OH! >

)" C %OH! >

y ! 9 8 9 !P " 0 { d

"! H C

>

)8 9

>

S "! P >

??B

?B

RO

d !F 8 9 !P " "

y ! 9 .b Qa & ]

8 9 R; %_

" T) 0 = B !)

) B ?+ )

) %OH!
T 0 "!<

? 9

! "8 9"2 0 o )

B = B !) B

" D B% 0 Q

!H C >

M % GaC

= B !) G ! ?
B

T + !1

) B

=2 RC !

] Kf

T ?B " 1+ R; 0 T? 9
=2

R; Qd "

?)" C
)

I 9 r +a
d !F

R " d

) B

9
"

.b
)" C %OH! >

) S "! H

y,+f "

y,+f :

0 >

"! H

y,+f :

0 >

void fact(int i, int j)


{
//code
}
void fact2(int i, string st, double b)
{
//code
}

"!H

! y,+f :

int fact(int i, int j)


{
//code
return
}
string fact2(int i, string st, double b)
{
//code
return
}

' ?B S 9 Q
% a9 "

+OH!

+B F & 1+
??B

" CB" " 0 " 1+

d !F & 1+ ! "

? >

8 9 M , CB" " !)
?)"

private void button1_Click(object sender, EventArgs e)


{
textBox2.Text = fact(5).ToString();
}
private void button2_Click(object sender, EventArgs e)
{
textBox2.Text = fact(4).ToString();
}
///////////////////////////////////////////////////
/////////////////////////////////////////////////////////
int fact(int num)
{
int factoriel = 1, i;

! r 7
7 G
!_ VB

"

for (i = 1; i <= num; i++)


{
factoriel = factoriel * i;
}
return factoriel;
}
//f///////////////////////////////////////////////////
/////////////////////////////////////////////////////////

Q B

+B F

5 !

CB" " !)

T "!B C " 1+ 8 9 0 !H
?+

rT

+OH! R

8 9 >!

! G C) -

private void button1_Click(object sender, EventArgs e)


{
fact(5);
}
private void button2_Click(object sender, EventArgs e)
{
fact(4);
}
///////////////////////////////////////////////////
/////////////////////////////////////////////////////////
void fact(int num)
{
int factoriel = 1, i;
for (i = 1; i <= num; i++)
{
factoriel = factoriel * i;
}
textBox2.Text = factoriel.ToString();
}

%OH! T)

?$

P$ B %F!H T ) d "

? "!H

F 8 9 r +a
T

& ]"

R;

) d"2 M9 9

> )!+
p

<

!C) ! "

8 9 = % F B r8 9 " 2 > ! !P " L

8 9 R; > ! M ,B

) d !) n

8 9 = ! 0 + AD

3b Qa Q7

3b

B% 0

) @AB v

y ! 9 private : 0

" S %
R C ) ! *+

8 9 > , public
8 9 !H B T?B
??B " 1+

%`

+O`H0 & `]
T ""

%OH! >

private G+

8 9 B CIF
& ]G "" C

+a G

F T 0 "!<

I;

8 9 G 0 ? 9 C ) @AB !P " T ?B
d !F

"2

>0 r +a

b Qa

+OH0 & ]

?
8 9

8 9 !H
D

$0

b
!P

!_ " 1+ "

"2

H"

8 9 "!B -A B

t C)

r +OH0 8 9
" 1+

!_ ! 8 9 Qd " 5!

9 ??B
rT )"

d !F
gU 9

R;

R " d 8 9 +OH0 8 9 "


T )"

=2

+OH0 8 9 0

private void button2_Click(object sender, EventArgs e)


{
textBox2.Text = fact(4).ToString();
}
///////////////////////////////////////////////////
/////////////////////////////////////////////////////////
int fact(int num)
{
if (num == 1)
return num;
else return (num * fact(num - 1));
}

M >

I$ R $
?B

if

\!U " D "

?B

" + !F 8 9
d !F

L" d 8 9

I$ " D
?B

?B u!F
! else

4*fact(4-1)

"

! !0 B "

else

!_! 5!

"

8 9"

3*fact(2)
2*fact(1)"
\!U

3 " Q] - "

\!U . "
!0& ]

"!H
9

! !0 B

,-! "

8 9%

! G = !H " "

!_! 5!

" " %OH! .

4*3*2*1
fact=T num=n u!F "!B & J

R 0

r )
`a$ T `

+ " !P a

% ` \ d A] G

?B " y,+f > ) : 0 >" 0 "

B T ?B y ! 9 m? !+

9 T ) f !H

T " P

;
)T+

j<

R 9

; (b
G

d !H A7 T ?B

g `] : 0 A7

?B fO

T `?a fO`

;=

` ?B
`

)O
k`n

;:
T 0

I ; )"

% FB )

; G+d > ! T !

%B ! % AD 9 "
;:

"2

F )" !_ R; " ! "

!P " : !)

6b Qa " T ?B
?B fO

;V

; !
+

G! ?

!+B B %

fO

% F B )"

>!

"!B y ! 9 B > 0 0 { d ! "

6b
`

; T)

%` " R; ! " `

;M

,- M

` V ` 0 " 1+`
T)

T 9

! H !_ !P a

% FB

?B " ) ,-

; 0 " 1+ 8_

!_ VB Va9 M "

; !H

R; T)

; T2?< !K?D! 0

?B )"

7 " A7 %F

Textbox1.text=myarray4[5];
VB ` % S M "

R; Vw

)"

T ?B

y! 9 ]

) m? !+ 0 >

;
T)

private void button1_Click(object sender, EventArgs e)


{
string[] str = new string[100];

!_

for (int j = 0; j < 100; j++)


{
str[j] = "Computer = " + j;
}
for (int j = 0; j < 100; j++)
{
listBox1.Items.Add(str[j]);
}
}

` y` ! 9 `B > ` ; 0
Q

" d !9 w B Ram > sF 8_


#b Qa

" ?B

y! 9>

! 0 B > ! Q _ C = > sF !H

; C

?B

+_

?B

1-16
private void button1_Click(object sender, EventArgs e)
{
int[] str = new int[100000000];
for (int i = 0; i < str.Length; i++)
str[i] = 444444;
}

j F % P 344 M " = > sF ! 0 B > ! 0

= cpu

R; 5 9

%
Q7

Q] =
+" T) d

H H >

= > 2B " a?

R; ,d " +d

" 9

U 9 =

= 0 > "

+ " @ "; H " " z !p 0 cpu ?B


+_ ^TB , dN % %

@ "; M
Sd )

2? "

/b Qa

" B

t C)

OB Qa

" B

, B M % F!n > " %

!_ + " H H >

d fO9 + S N ?B

)O

Qa T) d

! ^cpuN

& DAp T ?B ! de =

! de R; " 644

d A7

)"

"

int

!_ @ ";

44

>

; Q7 T ?B

" sF T "!B )"

y! 9>
; +_

+ S T ?B

P?) ^ % Q D T+
* ^L !+O % GaC N

"!B
= : ` G` " 8`_

" T `?B

y n 0 "

<j F

y ! 9 int32 0 : M

d ]=

" ?

"

* =

) sF G

+_

% % (

! de

> ) = " r +a
d !) Qa G

^8*4=32bitNT ?B

"

* y"

/b
R;0 B " " "

"

,-

>0

" <

,- G = " O

R 0 ?
" 1+

) ,;R

"

" L"!H > !


Foreach

`?B

%B!- R; R < 9

" `B > `B ` 9

"

; !] ?D M9 M9 >
" d "h B; Qd "

Q`d " " %` " !`_ R; > !` Qd "

! B% & ]G
T)

,- G "!a,CD

M !] ?D G >

G+F = P?) " B >!K?D +-

?B !

! %B!-

!) " [2]
+

R; Qd "

B% G
T

,- G

,C 0 %

? 9 " 9 ) ,- %

=0h >

" " j C R; 0 " 1+


?$ >

">)

(b Qa " ?B " 1+ " d

; >!

p%

=0h

(b
for

` " 1+`

MessageBox.Show

`? " ` = 2 > B ! B %
"

" 1+

0 " `
d"

" " j `C " B kS _ " ! B


9

"

MessageBox.Show

!< ! B 0
0

?B

,- h

*< +
S

)O 0 ?

B "

d !H r +a

d !H G ?lC) "
" B Q F R"!B <
r 7

private void button1_Click(object sender, EventArgs e)


{
MessageBox.Show("Hello ...Mr");
}

private void button1_Click(object sender, EventArgs e)


{
if (MessageBox.Show("Hello ...Mr", "my", MessageBoxButtons.YesNo,
MessageBoxIcon.Error)== DialogResult.Yes)
{
label1.Text = "OK";
}
else
label1.Text = "NO";
}

M` `? > `

" ` ; A7

?a QCD >

?$ V !9 M ? >

+F " + ) y ) x

>+

?$

; r>

" B % >

?$
" V !9

!`+CB V ` M

[5,5]

!+ " " "

: ! !1] 0

;V

B "R $ +S
[4,4] Q7 T ?B !Be

r T ?B

QCD ! 0 Qa

? R; R

)"

>

"

; y ! 9 >!

; )"

> ! r +a

private void button1_Click(object sender, EventArgs e)


{
int[,] ms = new int[10, 12];
string[,] str1 = new string[100, 108];
str1[1, 4] = "Csharp";
ms[9, 9] = 123;
textBox1.Text = ms[9, 9].ToString();
textBox2.Text = str1[1, 4];
}

r 7

?B " 1+

9 " 9 > ) ,- 0

I; R

d >

?$

private void button1_Click(object sender, EventArgs e)


{
int[, ,] myint = new int[10, 10, 10];
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
for (int k = 0; k < 10; k++)
{
myint[i, j, k] = i + j + (2 * k);
}

}
}
}

r ?B " 1+ foreach ,- 0

TI C > ! R

!H

foreach (int i in myint)


{
listBox1.Items.Add(i);
}

`) `9 G `

` d B M` " u!`F T R + !

" `B " " "


+d

I?

`a? > !

>" 0 "

P$ a? h - " " "

?B " ] R !

T`) +_
`B %

_ 9 A7 " " "

?B S 9 +-

?B ! C 9

" ; "

T)

! R 0 "

` @AB R; R "

" 1+

> ` t_ 0 T +`

T "
d

+_

R0

G`

=`

G`

T ?B " 2

9 >" 0 "

R;
9

7 % !+I ) @AB TIF > !

t_N +C _ = B !) " B

H"

" ; " "!

I; 0

"

? H

9
"

y ! 9 @AB M

a T + " 0 R;

9 R; " B T?B

y ! 9 door =

@AB M

0 >

! G

!P " @AB M

t_ B

QCD & ] G
m

@AB

! "

! M % !+I T+1H @AB > ! B " > "

9 ! C 9 >!

? T ?B

y ! 9 R; 0

9 R;
> B

+-

)! 9

%_ !) B G

T ?B

I;

? G

^object-orientedN !H
R; 0 " 1+

""

9 !P " 9 " M + h > " 0 "

d B ?B u!F h - \ d T

R C ) B T ?B

!
?

m` R; " T `?B ` " `2 m =


""

d B
0 ^>

9 ] ) d

` !+ " @A`B R; `,d " & ] Kd


@A`B 0

* Y1+ %g"

9 ] T) ?B " & t_ G 0 9 ] R" " !_

A7` T `
T ?B

t_ G+ "!

M T ?B " 1+

y ! 9 G T ?B
" T ?B " 1+
T ?B
T ?B

y! 9
y! 9

<

! R; "
G
M+ h

= ` ` @AB M

"!B [3]%

M ,B "!B " 2

B > c !< = > ! % F B @AB M " 2 > !


b Qa Q7

?B F U

b
)" ! *9 color

" d @AB =

fS"

"
using
using
using
using

" 2 C @AB 9 ?B M ,B add CB" >

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace WindowsFormsApplication33
{
class color
{
}
}

8` 9

`) !` *+ `,C 0 T ?B y ! 9 @AB Qd " T ) f

$ !) T 9

h-

" 2 m @AB
r 7

class color
{
public string clr;
public int Weigh;
}

`CD !H

+ "

9 T "!B y ! 9 R0

` R `9 ` @A`B G C) Qd "

FT

+ "

m >!

CD ! *+ "

!+ "

! " I;

T+

"!B -A B

9 C T "!B C y ! 9
T

M` ,B

" R; > N ` ?B

T `

@A`B =

r! 0 B Q7 T )"

=2

`d !F

R; M` ,B "

)" !_ CB" M

B% & ]G
R"!B new QCD

B
T

t C)

+ "

! =!F >

?B " 2 m @AB 0
@AB = > ,

!+ " I ;
! h-r

fS" =

^ ?B
M

private void button1_Click(object sender, EventArgs e)


{
color mycolor = new color();
}

m`

` 9

+ "

!+ " @AB ,d " > sD


rQ7

?B ?B )"

mycolor

, B 44

R; R0

0 " 1+
"0

private void button1_Click(object sender, EventArgs e)


{
color mycolor = new color();
mycolor.clr = "# 2";
mycolor.Weigh = 100;
}

r )" !_ VB % a9 M " I ;

R C) 0 " 1+

color mycolor = new color();


mycolor.clr = "# 2";
mycolor.Weigh = 100;
//////////////////////////////
textBox1.Text = mycolor.clr;
textBox2.Text = mycolor.Weigh.ToString();

?B \ f+ >!P " & KfO !P " G

>!

d !H % G

M > ! & KfO G

r 7 ? B y ! 9 @AB G 0 >!P "


private void button1_Click(object sender, EventArgs e)
{
color mycolor = new color();
mycolor.clr = "# 2";
mycolor.Weigh = 100;
////////////////////////////////////////
color mycolortwo = new color();
mycolortwo.clr = " 37";
mycolortwo.Weigh = 500;
///////////////////////////////////////
textBox1.Text = mycolor.clr;
textBox2.Text = mycolortwo.clr;
}

B u!F
M

!2?< 0

^ ?+ ) @AB T) ) =!FN ) =!F ) @AB

!+ " > ! T+1H A _ B


+ "

= " CB" "


+ "
:

!+ "
??B " 1+

?B

d !F
9 C

"2

?B " 2 =!F >

CB" " B , _

? + C) 9 ?B y ! 9 0 0 { d "

C) 9 ?B y ! 9 { d "
T ?B

R; M ,B "

y ! 9 ^ CB" M ,B "
r 7

) ! *+

y! 9: G

solution explorer

! !P " CB" M

?B " 2 R; 0

@AB

,_

? H

Q7 N 8 9 M Qd "
? H

!+ " I ;

CD > )
! *+

t C) r +a

+_

-r +a
M

!+ " > !
) ! *+ , y ! 9
+ "

!+ " ? +

B ??B " 1+ R; 0 ? 9 C R !P "

G` " `2 > !` T `?B ` y ! 9


T ?B
using
using
using
using

)! *+

R; " T ?B

\ f+ door

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace WindowsFormsApplication33
{
class door
{
public int numberOFdoor;
public string NTire;
}
}

R; =

" 2 door =
F T ?B

!P " @AB M
QCD Q _ L

Q7 @AB

r 7

?B " 1+ R; 0

?B " 2

@AB G 0

private void button2_Click(object sender, EventArgs e)


{
door myclass = new door();
myclass.NTire = "2 3";
}

r! 0 B Q7

"!H!

>!

" D " 8C

B ?B F U " d @AB

8 9M

class door
{
public int numberOFdoor;
public string NTire;
public int MYT(int i, int f)
{
return (i + f);
}
}

? CB" > !

!0 B

private void button2_Click(object sender, EventArgs e)


{
door myclass = new door();
myclass.NTire = "2 3";
int Y = myclass.MYT(4, 6);
textBox1.Text = Y.ToString();
}

r>! E
`a? !`P
!`H
`
E

7 G

+ "
""

` R; 0 " 1+`
`

!+ "

+1H

0!F

T ?B

AB =

F @AB !) ?B

< t >! E G

y ! 9 door 0

% ` ! `< R `a VaD!

T ! E R; 0 T ) d

" d ,d " > sD

S T

M
+ "

T ! E !P " @AB 0

+_ T ! E
!+ "

-A B

@AB M

color @AB 0 door @AB

color @AB

+ H : % AD @AB = > ,

t C)

,d " > sD

T 9

B% & ]G

>!

rQ7 T

namespace WindowsFormsApplication33
{

:color

class door
{
public int numberOFdoor;
public string NTire;
public int MYT(int i, int f)
{
return (i + f);
}
}
}

r @AB
T `?B ` " 1+` ^N %` AD 0 !`d; " T ?B
0 T `?B )"

@AB Qd "

M` y ! 9 > ! %
^

y ! 9 @AB 0

) ! *+ 8_ R C) T ?B

y ! 9 8_

+ !< Qd " R C) )

y ! 9 @AB = T) )

+_

y! 9

"!B -A B
M

R" + !F Q

t C)

+_ T ) f !H \ d

T ?B

" 1+

NrT ?B QCD ! 0 ? @AB Qd " " % F B

class color
{
public color(int i, string j)
{
this.clr = j;
this.Weigh = i;
}
public string clr;
public int Weigh;
}

r 7 T ?B

)"

R; @AB 0

M y ! 9 8_

?B o- % !+I

"!B " 2

>! E !H B G+

0 Q_

private void button2_Click(object sender, EventArgs e)


{
color cl = new color(4, "; !.");
textBox1.Text = cl.clr;
}

M` `a? !`P " `

$"

S d + !< Q _ Q7
rQ7

y ! 9 8_
Sd

R;

d !H h -

?B y ! 9 !P "

class color
{
public color(int i, string j)
{
this.clr = j;
this.Weigh = i;
}
public color()
{
}
public string clr;
public int Weigh;
}

!`P " M`

`?B " ` 9

G`1,9 , 2O` "

C` , H"

!`) > !`

`)

: G ?$ ? % R"!B S

wB ) @AB !P " >

d = ,= Q

) & KfO

; G ?$ B % ?

` ?B y` ! 9 k 9!9 G C)
BG

H"

@AB 0 " 1+

!` de ) object 0 >

B
M

d = >!
%

; " T ?B

dL
y! 9

2O "
?B a$
;M

" P

= >!

A] G

d !H A7

9
!_

& KfO !P " @ ";

; M A7

?B y ! 9 KfO

B ?B )"

M 2O " !) > !

,C 0 r

I; a
) =2

a
;M
T ?B

" ` 9 `

`B G

+S

?B

! de " d "

M B % int ?

" " T) d g U 9

R;

object r +a

B ?B ! de ArrayList M

'
`_AD & ] " Q S

!_

1] >

.4b Qa z t

! VB % a9
)" !_ =!F >

2O " & KfO

?B " 2

! M

! ! de CB" M

)" !_

! r

a? > !
1] "

.4b
! 0 B Q7
using
using
using
using

?B " 2 stud =

@AB M

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace WindowsFormsApplication34
{
class stud
{
public string Name;
public string Family;
public int StudNumber;
public int Tel;
}
}

?B " 2

444

;M

^M ,B "

N ?B M ,B

" ! de CB" >

private void button1_Click(object sender, EventArgs e)


{
object[] MStud = new object[1000];
}

` d M` " 2O` " M & KfO ! de CB" >


`- M` CB" M ,B

!) " 9 T ?B

! M ,B

" 1+ V

!)

M 0

rQ7 T ?B ! de

B% & ]G

BL

; " L"!H > ! "


;>

d " "

! de

FU V

int i = 0;
private void button1_Click(object sender, EventArgs e)
{
object[] MStud = new object[1000];
}

` M`

" !` % " 0

T ?B

M ,B

CB" B %_ !) 9 ="!B y ! 9 { d

r! 0 B Q7 T ?B C new S T ?B

y ! 9 @AB

int i = 0;
stud mystud;
private void button1_Click(object sender, EventArgs e)
{
object[] MStud = new object[1000];
}

` M` `CB" M ,B
"2

!) " B

!) " h - T " 0
B

+ "

G ?$

9 +a G
?+ )

T ?B

B % ? %,D T "!a new h !$ a?


! de

; "

a = > " ?$ !) , _

int i = 0;
stud mystud;
object[] MStud = new object[1000];
private void button1_Click(object sender, EventArgs e)
{
< * 8# 0
72 ! # 4 & -*# # , )# #
0
5
////////////////////////////////////////
mystud = new stud();
mystud.Name = textBox1.Text;
mystud.Family = textBox2.Text;
mystud.StudNumber = int.Parse(textBox3.Text);
mystud.Tel = int.Parse(textBox4.Text);
/////////////////////////////////////////
MStud[i] = mystud;
i++;
}

% ` S " T "!`B !` de >! "

9 VB % S M

T )"

!_

R; T ?B

"2

% & 1+ "

1] " !_ !P " CB" M

T )" j C VB

private void button2_Click(object sender, EventArgs e)


{
for(int j=0;j<i;j++)
{
stud ii = (stud)MStud[j];
listBox1.Items.Add(ii.Name + " " + ii.Family + "
ii.StudNumber + " " + ii.Tel);
}
}

& K`fO `9 `

j C CB" T) !d; " ?B ! de & 1+ KfO "


! de CB" ,-! !) " B

"

`?B 2+ `

2O` "

C` @

?B F U !P " VB % a9 M
`

`9

; !] ?D M9 M9 >

! B T ?B F U

CB" M

+ "

! B% & ]G
)"

?B !

9 +a G

B G >! %

" +

2+

!
F ?B

)O

M T) d

" "

< B )" = * < R"!B

<& ]

BL

= * < " ! ! 2B !)

!0 B=

CB" > !

?B

%B!-

FU B

private void button3_Click(object sender, EventArgs e)


{
for (int j = 0; j < i; j++)
{
stud ii = (stud)MStud[j];
if (ii.StudNumber == int.Parse(textBox5.Text))
{
textBox1.Text = ii.Name;
textBox2.Text = ii.Family;

textBox3.Text = ii.StudNumber.ToString();
textBox4.Text = ii.Tel.ToString();
MessageBox.Show(" '=
");
break;
}
}
}

Get{}Set{}
T `f @A`B 0

R; T ) f !H

?`< `9 M G " D A7 T ?B "


] K`d ! *+ M

?B " 2

set 0 T ?B )"
R; )"
@AB M

@AB "
8_ T 9

] Kd > )! *+ T ) f !H
G ?lC) T ?B

" 1+ get 0

7 > ! T ?B ! de ] Kd ! *+ " T 9
r ?B y ! 9 ! 0 & ]

public class myclass


{
private int _NUM;
public int MYNUM
{
get
{
return _NUM;

F
R; Qd "

}
set
{
_NUM = value;
}
}
}

>

` R `C)

value

N T d

)"

MYNUM

0 " 1+

_NUM

^ )" !_ %

!_

] Kd ! *+ h
MYNUM

7 "

! *+ " B %

private void button1_Click(object sender, EventArgs e)


{
myclass mc = new myclass();
mc.MYNUM = 1394;
textBox1.Text = mc.MYNUM.ToString();
}

r ?B "

)"

8_

d !H

set
{
if (value > 0 && value < 15)
{
_NUM = value;
}
}

get 0

)" ! *9

R;

f @AB 0

] Kd

M
r

F ) f !H
7

?B " 1+

public class myclass


{
private int _NUM;
private string _Str;
public string Str
{
get
{
return this._Str;
}
}
}

?B " 1+

I?9

public string Str


{
set

set 0

?B " 1+ R; 0 @AB "

!P

F +

d !H

{
this.Str = value;
}
}

r =!F G ?$ 0 " 1+
!`_

1`] " next `CB" M` A7`

c !< R"!B F U Q7 c !<


> !`

?B " 1+ =!F G ?$ 0

=!F R"!B F U > ! "

?B \ f+ " d =!F > ! = M

d !F = "

d )

! 0

1] R; >

?B M ,B Windows Form >

4b

"

! M ,B

QCD

?B

?B M ,B Add CB"

VB % a9 M T) = " =!F > !

)" ! *9 next

R; % a9
?

" " !_ CB" M

1] CB" > !

private void button1_Click(object sender, EventArgs e)


{
Form2 m = new Form2();
m.Show();
}

!0 B

1] !
)" !_

` M ) R;

!+ " > ! G ! ? ?+ ) ) @AB


T ?B

`B Q7

d !F

?B R I?< ActiveForm.Hide() 8 9

R;

I !F R $ B % & ] G

BL

=!F @AB Show() 8 9 T ?B

" 2 I;

" O " " j C !P "

=!F +

d !H
r! 0

private void button1_Click(object sender, EventArgs e)


{
Form1.ActiveForm.Hide();
Form2 m = new Form2();
m.Show();
}

?B
!

%C _ "
>

d !F

R; show +

?B " 2 R; 0

= " =!F +_ !P " % j C


!0 B

! = " =!F "

T)

- " = " =!F

=!F 8t_ > ! %


%C _ 0 "

- "
d !F > !

"!H 0
?B

=!F

R I?<

=!F a, %

d !H

=!F +_ r +a
O +

? = " =!F

Q B

FormClosing

?B M ,BFormClosing

private void Form2_FormClosing(object sender, FormClosingEventArgs e)


{
Application.Exit();
}

vD vD T) h 8 9

! =!F G+

-"! B B"

!
"

properties %C `_ 0

)" ! *9

=!F 0

"! H !_ j C
+ ! B +

)" !_ FixedSingle! !

`` " ``

" " j ``C =!``F >

1]

d !H

" ! = P?) C

``

O 0

=!F startposition

)" !_ False ! !

`` F " O`` " " j ``C =!``F ``


)" !_ Control m ! !

! QB

! =!F a? > ! r +a

)" ! *9 CenterScreen

formborderstyle

> ``)

0 FormClosing

maximizeBox

+``

d !``H

=!F TransparencyKey

"
8`_
`

` ?B \ `f+ ^ <N

" " j C % =!F ! %O< B > $!)

1] G S R ?D

^=!`FN @AB = Program.cs %C _ 0

fS"
"

+a+ " VaD

! > I !F 0 M !) +
!

1] G S R ?D

d !H r +a

1] G

! >!

r )" ! *9

fS"

r +a
" !` 0 `B Qa`

` Mutex 0 `

- "

F C

r[1] ?B " 1+
static void Main()
{
bool boooooool;

d !H

Program

System.Threading.Mutex m = new System.Threading.Mutex(true, "

MyMutex ", out boooooool);


if (!boooooool)
{
MessageBox.Show("
!>
? # ! #
!3");
return;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
GC.KeepAlive(m);
}

A7` T `?B Q`CD K` =!`F " static & ]


R;

!P " =!F

=!`F " T ?B y ! 9 = " =!F " M 9 + ! *+ M

=!F M 0 >! "

= " =!F

M =!F 0 +

+ > ! r +a
M

+ >!

r ?B y ! 9 M 9 + ! *+ M = " =!F " r 7 T ?B )"


public static string Str = " ";
private void Form2_Load(object sender, EventArgs e)
{
textBox1.Text = Str;
}

r ?B )"

R;

=!F "

private void button1_Click(object sender, EventArgs e)


{
Form2.Str = "Computer..!";
Form2 FR2 = new Form2();
FR2.Show();
}

S Const
R ? B - > ! A7 "!B

) d " 1+ R; 0

2?

{"

" B ,aO

R ? B >!

?B

A] QCD

% JM B% & ]G
!)

T ?B

" 1+ % J R; 0

-G

) ]
BL
! "

) ]

! " B

? B ) ] >!

R ? B -

!H

?B u!F

! " + J

! *9 & ] " B % ? " " "

) d Q- ) % J
T )"

"0 >

!_ R; R "

QaO G
0 "

)" ! *9 y,+f
T ?B

y! 9

0 % F B ) % J y ! 9 > ! T )" ! *9

% J

! G+ " R; R" ! *9 Q _ ! ~ ) % J >

R; % F B

F " !"

,C 0 T ?B " 1+ R ! *+ Q
7

? 8C >!P "

! *9
"

8_

const

R;

% AD

S %

const int price = 1200000;


private void button2_Click(object sender, EventArgs e)
{
int hamed=price+2000;
int nader = price * 2;
int mahmod = price - 5000;
}

Dialogs

> !` >

1`] ` ?B !` de

" `B ?+ )

>

) dialogs R C) I? "

) d

+_

!< Q F !

; j < !+O C > !

= C 0

"

T 0 "!w I ;
' )" j C openfiledialog
)" !_ =!F " CB" M

openfiledialog

"" j C C
T) d

VaD M B

picturebox

? G

%C _ G
! r

! G = 2 >!

j `C v`D ShowDialog^N 8 `9 `B %` & ] G


! de FileName " Q F G Q B !

?B

BL

\ f+

? CB" > !

, F !2?< " ! B +_

BG

"

!2?<
"

private void button1_Click(object sender, EventArgs e)


{
openFileDialog1.ShowDialog();
// pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
pictureBox1.BackgroundImage =
Image.FromFile(openFileDialog1.FileName);
}

^ `)" j C N ?B 0 bmp jpeg

<

) VaD

F A7
r T ?B

?B !+, F

openfiledialog

" 1+ ! 0 B & ]

d !H

Filter

private void button1_Click(object sender, EventArgs e)


{
openFileDialog1.Filter = "jpegfile (*.jpg)|*.jpg|bitmap|*.bmp|
All files (*.*)|*.*";
openFileDialog1.ShowDialog();
// pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
pictureBox1.BackgroundImage =
Image.FromFile(openFileDialog1.FileName);
}

T )"

!_

1] " MenuStrip M CB" >

? R; Qd "

!0 B

?B M ,B

T )"

! *9

" Open> ! File 0

private void openToolStripMenuItem_Click(object sender, EventArgs e)


{
openFileDialog1.Filter = "jpegfile (*.jpg)|*.jpg|bitmap|*.bmp|
All files (*.*)|*.*";
openFileDialog1.ShowDialog();
// pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;

pictureBox1.BackgroundImage =
Image.FromFile(openFileDialog1.FileName);
}

h `- "

j C VB % a9 "

?B

?B T ?9 Qa z t

)" !_ =!F >

9 )" ! *9

R; 0
? R; > !

)" !_ =!F >


!0 B

?+ Q F M B >

txt

! ? M

textbox

?B M ,B

! r
,_

richTextBox

7 Q7

" ? " open text >

private void oPENTextToolStripMenuItem_Click(object sender, EventArgs


e)
{
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files
(*.*)|*.*";
openFileDialog1.ShowDialog();
string str =
System.IO.File.ReadAllText(openFileDialog1.FileName);
richTextBox1.Text = str;
}

` ?B !` de

R;

` ? R; "

" `d

?B \ f+

`fS" & D
?+ Q F R;

?B " 2
opentext

" ?+ Q F M

?B !

"! H! "

1] = C9 9 )" !_ Fill ! !

richTextBox1

dock

d !H

r 7
1`] " savefiledialog M` openfiledialog >

?B ! de

VB Qd " G+
?

BG

d !H
)" !_

private void saveToolStripMenuItem_Click(object sender, EventArgs e)


{
saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files
(*.*)|*.*";
saveFileDialog1.ShowDialog();

System.IO.File.WriteAllText(saveFileDialog1.FileName,
richTextBox1.Text);
}

ColorDialog
"

" 1+ m \ f+ > ! S " G 0


FontDialog
"

" 1+ % F \ f+ > ! S " 0


r

)"
)" !_ =!F >

! *9

label % F =!F ? CU %O< m

% F S " 9 "

? R; > !

)" !_ =!F >

!0 B

B>

7
!

! CB" Q S M

?B M ,B CB" >

private void button1_Click(object sender, EventArgs e)


{
colorDialog1.ShowDialog();
fontDialog1.ShowDialog();
this.BackColor = colorDialog1.Color;
label1.Font = fontDialog1.Font;
}

!F

)O

2 + 9 ?B \ f+ " d > ! % F m M

?B !

!F

)O

2+

)" ! *9 ! 0 Qa

,_ B -

private void button1_Click(object sender, EventArgs e)


{
colorDialog1.ShowDialog();
fontDialog1.ShowDialog();
button1.BackColor = colorDialog1.Color;
button1.Font = fontDialog1.Font;
}

T) d ? ; )

! Qd " "

" " ) S "

Timer 1-12

R;

B B"

%` !C `9 ` )
M` ` J " !) " B
!`_

" 1+ !C 9 0 " O !
! 0 >
? >

B@
! r

1`] " CB" " VB % S M

M` ,B ` " !C `9 >

^%

]dR 0&

" B

" 1+

! 0 >

"
7 "

! < R a )

!C 9 M

JM! !

? >

d !H

" !C 9 0 %

! G G+

"

!C 9 !H

B G = 2 > ! ' ?B F U VB % S

) !)N )" ! *9 .444


R; Qd "

!0 B

!K?D

!C 9 interval

"

d !F R; "

private void timer1_Tick(object sender, EventArgs e)


{
listBox1.Items.Add("Computer");
}

? = "

CB" > !

! 0 > ) B k 9!9

private void button1_Click(object sender, EventArgs e)


{
timer1.Start();
// timer1.Enabled = true;
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Stop();
}

)"
9 ?B

"

R; +

d %_ !)

?B B

: ! !C 9 9 ?B M ,B & +

CB" >

?B !

!
?B y_ +

true

!C `9

Enabled

`B

R C)

?B B

: ! !C 9 B" d

CB" R

d!H
?B

? R; Qd " ^>0 S FN ! 0 B "

d !F =!F " S + 9 ?B M ,B =!F S d > sF >

private void Form1_Load(object sender, EventArgs e)


{
timer1.Start();
}

r! 0 B Q7

)" ! *9

B z !p 0

!C 9

Interval

G ?lC)

private void Form1_Load(object sender, EventArgs e)


{
timer1.Interval = 100;
timer1.Start();
}

T "!B

R;

>!K+f Q _ jf " B >

"

!+O

T 0 "!<

I ;0 " 1+

) T +1H T ?B v
2? "

f +B 8 9

"

5 !

I ; ,d " > ) @AB I ;


F U u!F j < & ]

& a 0

" !+O
!

CB T ) f
!H

d!

2? "
!_ " 1+

?$

B" ""

> ) @AB ^ ?B F U C N%

FU

B ! 0 ) " A7
T ?B

R; > 9

using System.Collections;

M % F B R;0 " 1+ > ! )"

=2

+O< B B " " "

T+

" [3]> +O< @AB A7

! 0 B Q7 T ?B " 2 R; 0
System.Collections.Stack Stk = new System.Collections.Stack;

9 "

"! R;0

?B F U

?)

+O< >h 0 G+ "!

=2

! "

!K?D +O<
+O<

! "

0 " 1+

R"!B F U & ,CD " " "

h-

@AB G "
Stk.Push1;
Stk.Push2;
int i = Stk.Pop;

!K?D "! H
>!K?D T ) d

!_ o!n 9 " "


+_

!H

"

F U R;

!_ !P " !] ?D k 9!9 G C)

^CD \ _ ? N T "!B F U +O<

%C `_ %

=0h
? %

>!K?D +_

FU

F B ?B " 2 R;0

B ?B

"! H

!_

+O<

!K?D >

>

B % >!K?D G !d; !K?D R; T " ! +O< 0

) B & ] " B T?B


M

QCD F!n ?

@AB =

+a G
F !H

GCU "
?

Stack Stk = new Stack;

" ` < ArrayList @A`B " `B "!`B

` >

? T ?B " 2

<>)% S

M R;0 % F B

R 9

f +B G > ) @AB !P "0

@AB G 0 " 1+ > ! %

>0

ArrayList myarray = new ArrayList;

T ?B F U

! "

R;

myarray.Add(123);

T ?B )"

R; T 9

!0L
myarray[0]=123;

>!K?D %_ !) a, T ?B !Be
?B

QCD >

!` deobject0 >

jS p )

; ? %

< % S ? @AB G 8_ " "! H


;"

=0h B % G @AB G kS
! " R; > ! sF L" d T ?B

R 2O " & KfO B T "!B QT ?B

S 7 I AB v

Q- ArrayList 0 " 1+

using System.Collections;
namespace WindowsFormsApplication34
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
stud mystud;
ArrayList Mstud = new ArrayList();
private void button1_Click(object sender, EventArgs e)
{
////////////////////////////////////////
mystud = new stud();
mystud.Name = textBox1.Text;
mystud.Family = textBox2.Text;
mystud.StudNumber = int.Parse(textBox3.Text);
mystud.Tel = int.Parse(textBox4.Text);
/////////////////////////////////////////
Mstud.Add(mystud);
}
private void button2_Click(object sender, EventArgs e)

"

) H

F U R;
R 9" !H

7 R C) h - "!B

{
for (int j = 0; j < Mstud.Count; j++)
{
stud ii = (stud)Mstud[j];
listBox1.Items.Add(ii.Name + " " + ii.Family + "
ii.StudNumber + " " + ii.Tel);
}
}

" +

private void button3_Click(object sender, EventArgs e)


{
for (int j = 0; j < Mstud.Count; j++)
{
stud ii = (stud)Mstud[j];
if (ii.StudNumber == int.Parse(textBox5.Text))
{
textBox1.Text = ii.Name;
textBox2.Text = ii.Family;
textBox3.Text = ii.StudNumber.ToString();
textBox4.Text = ii.Tel.ToString();
MessageBox.Show(" '=
");
break;
}
}
}
}
}

FOREACH ` ,- 0

`?

` )" !` *9 ` Qa` G

button3_Click

2+

CB" B
?B " 1+

private void button3_Click(object sender, EventArgs e)


{
foreach (stud ii in Mstud)
{
if (ii.StudNumber == int.Parse(textBox5.Text))
{
textBox1.Text = ii.Name;
textBox2.Text = ii.Family;
textBox3.Text = ii.StudNumber.ToString();
textBox4.Text = ii.Tel.ToString();
MessageBox.Show(" '=
");
break;
}
}
}

"! H

=2

B G arraylist 0 " 1+

"!B -A B

t C)

`B0 Q _ !H

7 >!

` ; `

)" ! *9

R; ^Name N % !+I

B %C _ " )" ! *9 Search

R; =

?B B

) !+?B

a? > ! r +a

CB" > !

button3

+ "

! G

!+ " I ;

private void Search_Click(object sender, EventArgs e)


{
}

S * =b
!`2?<

O` !`

" !` ` R + ` ! `B

; j < , d C >!

. b Qa > td !2?< Q7 "

T+

=+ "#g"
)

p "

" " j C C > ! > td

. b
..b Qa Q7

)"

U 9

td C

"!B ! F5

! !H

..b
% `a9 0

" `D M B +

>

! A7 %

` G ! ? % m? !+ : 0 ?B

% " "!B "

%F " B D

%` " `D : ` 0 g `] m? !+`

` 0 ` 8 `9 G

T `H ` 8`_

$"

"

"" `

Q- QaO G 9 T ?B " I?O < T 9

! `B T ) f !H A7 T ?B !+?B
r! 0 B Q7 T ?B !+?B

S T) =2

9
+

$T? T) d

QaO G & a !P "


QaO G T 9

B> +

VB % a9 R $ S

! "123m" ?B "
I,-

?B
9

2?

int

?a "

private void button1_Click(object sender, EventArgs e)


{
if (textBox1.Text != "")
{
int i = Convert.ToInt32(textBox1.Text);
}
}

"%

%F " VB

G ! B !H

) 5! 0 " 1+

5! M

Q 9 QCD
"1234" ?
?7+

$"

B % ? Q-

Sd +

VB % a9 "

Q`7

?B "

" D0 !~

% "

9 C & ]G

" ?B "

" D

F! B BT) f
r! 0 B

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)


{
if (!char.IsNumber(e.KeyChar))
{
e.Handled = true;
}
}

`B

&Aa` 0

>!`P " `,B L


R C ) `B

s` T `+ ` % GaC )
!`

` ` G ! ? T ?B

B% & ]G

+ catch Qd "
"

! >!

?7+` `) T "

C+- B T
"

*<

O ?7+

BL

$"

= C9

B s

< R; > !

" R $ ?+
+-

? j<

% try{} catch |}
d R C) 0

? >!P " B
! 9T

! !P " "!B "

?77++

$"

% "

) ?7+
! !H

2; "

? > B ) A]
+

\ d I

)" % GaC
!+?B L

R; B T !
try Qd "

! catch Qd " > ) B


td > ) = * < Q7

! B !H B T

)" C R;

>
"

7 >!

"" j C! B

private void button1_Click(object sender, EventArgs e)


{
try
{
int i = Convert.ToInt32(textBox1.Text);
}
catch
{
MessageBox.Show("please enter a number!!!?");
}
}

r! 0 B Q7

? > B ) catch Qd "

try
{
int i = Convert.ToInt32(textBox1.Text);
}
catch
{

d !H

`B

S T ?B

" 1+

finally

0 "

>! > B )

) ?7+
r 7

$ +

d !H

?7+ > " R; Qd "

private void button1_Click(object sender, EventArgs e)


{
int i = 0;
try
{
i = Convert.ToInt32(textBox1.Text);
}
catch
{
MessageBox.Show("please enter a number!!!?");
}
finally
{
i++;
}
}

> " `+ !`) `+ S N T ?B


` CI1

`I ; `B G+

QCD Qa G
8_

"

"" j C C

T+

o!p 0

*< +

d !H

I ; > ?7+ = * < R CIF > ! % " d !K ? > ?7+ = * <


.3b Qa Q7

.3b
r T ?B

QCD Qa G

T CIF

private void button1_Click(object sender, EventArgs e)

I? T

B -

{
int i = 0;
try
{
i = Convert.ToInt32(textBox1.Text);
}
catch(System.FormatException str)
{
MessageBox.Show(str.ToString());
}
}

"

" + !F

System.FormatException

r 7 T ?B " 1+

o!p 0

* < )"

System.Exception

?7+ !H & ] G "

0 T 9

?7+ : !H

private void button1_Click(object sender, EventArgs e)


{
int i = 0;
try
{
i = Convert.ToInt32(textBox1.Text);
}
catch(System.Exception str)
{
MessageBox.Show(str.ToString());
}
}

using System.Drawing;

0 " 1+

VaD M G+d

> ! A7 "!B " 1+

TI 8 9 " > " bitmap @AB "


a? > ! %

a F !H & ,CD = 2 > ! R 9

f +B G 0

" 1+ @AB G 0 y,+f > ) % !F

bitmap @AB

Q a < M m R" ; % "


"!H!

T ?B fO

Q a < R; V

R; m

% FB0

1n

a? > ! % ! "

)" j C
T ?B

y! 9

R; ,] m
Color

0 : M !0 B "

" "

Q a < R; V

Q a < R"!B m

" 1n
m

m M Color @AB

>! m M
T ?B

% FB

Qa < R; 9 T ?B !Be

P " d"

7 > ! ?B S 9

GetPixel>

SetPixel

9 T ?B fO VaD "

; " ! "

B %

,] m

)"

!_ m

R;

Color Mycolor = Color.Red;

r % ! 0 Qa

B "

Color Mycolor = Color.FromArgb(255, 0, 0);

,] m

!0 B "

7 >!

+ "

!+ " % RGB Q

B ,] m
r T"" j C

9
m

Color Clr = Color.Green;


byte _R = Clr.R;
byte _G = Clr.G;
byte _B = Clr.B;

T ?B S 9 m ^.6#.6#.6#N #///.

T 9

FromArgb 0 " 1+

S L

!`

" ;"

`fS" m

R; > ) Q a < [2]T ?B

"2

fS" 0

VaD M

T ?B

!0

7 "

! de M " " ) >

private void button1_Click(object sender, EventArgs e)


{
System.Drawing.Bitmap pic = new Bitmap(600, 400);
for (int i = 0; i < 600; i++)
{
for (int j = 0; j < 400; j++)
{
pic.SetPixel(i, j, Color.Red);
}
}
pic.Save("c:\\picture.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg);
}

>

d !H %F!H = 2

)" = 2 R; >

9 ,CD

> ) @AB
+F!H

! *9 256 9 !1] G 0

BG

) Q a < R; m M9 M9 % !+I

" T) m !) %

rgb 0 !` 0 `B " `7 > ! " " = 2 ! K9 >


r

+d
!

+F!H = 2 VaD >

"!B
?B B

RGB ,] m

0 "!< R 9

)O B

t C)

aD > ) Q a <
0 Q a < !) R $

" D G > a+ " G ! ? ?B

! InvertQCD 9 T ?B

TB .66 Q a < !)

private void button1_Click(object sender, EventArgs e)


{
System.Drawing.Bitmap pic =(Bitmap) Bitmap.FromFile("a.jpg");
pictureBox1.Image = Bitmap.FromFile("a.jpg"); 2
. A1 B @ 4 !3
2 #!=
for (int i = 0; i < pic.Width; i++)
{
for (int j = 0; j < pic.Height; j++)
{
Color clr = pic.GetPixel(i, j);
pic.SetPixel(i, j, Color.FromArgb(255-clr.R,255clr.G,255-clr.B));
}
}
pictureBox2.Image = pic;
}

%` ! < R a
`+ =0 "!`w
pixel R

;
`7 G`

`) 0

@AB G 0 " 1+

)" = 2 ! K9 L0 "!<

` `a? 0 Q` _ '" " 0 ` ! *9

S + 2 " VaD M

"

t C) T)"

!` "

! 0 VaD = I1 G " > ! %

Q a<

.44440 VaD G QB " " " u!D " Q a <

m` 0 B

!F

)O

R; > ) Q a <

? >

! K9 L0 "!<

d !H r +a
! r
" 9

Q aO9 m M 0 T) Q a < !) B %

` y ! 9 VaD M bitmap @AB 0 " 1+


T ;

aD R + R;

C T ?B
,_

"

44

p "Q a<
VaD G

7 "G ! ? %

fS" m !)

!_ m

U 9
Q aO9

#44 VaD G
+_ %

!P

+F Q aO9

+F Q aO9 9 1+ > )
R; > ) Q a < T ?B

` ?B

%B!- ) Q a < >

! 8_

" ?B

" T,_ M

! M " +_ C

^setN " ;

!`H A7`
) d

` )" ! *9
)O

R; > ) Q a <

)" 0

? ;!F G ! 0 B " ?B ! !

! *9

R; B

? >

R; Q a < !)

"

!!

"

fS" m

) d

R;

!H

I$ VaD M

'"!B
public static Bitmap Resize(Bitmap bmp, int Width, int Height)
{
Bitmap Temp = (Bitmap)bmp.Clone();
Bitmap b = new Bitmap(Width, Height, Temp.PixelFormat);
double nX = (double)Temp.Width / (double)Width;
double nY = (double)Temp.Height / (double)Height;
for (int x = 0; x < b.Width; ++x)
for (int y = 0; y < b.Height; ++y)
b.SetPixel(x, y, Temp.GetPixel((int)(Math.Floor(x * nX)),
(int)(Math.Floor(y * nY))));
return b;
}

> 0 `
> ! )"
` " `

T + !F
=2

VaD T ?B

? N "

y! 98 9M B% & ]G

! *9 & ,CD 8 9 T + !F

` y` ! 9 ` !` *9 R;

` Q a < !) 9 "
Q a<M

8 9 R;

9"

,] VaD %

" " ! *9 %

\!U I$

8 9

Qa < !) "

)" 0

!_ B > 0

!_ B > 0
!!

! *9 R;

BL
%

VaD M
,] VaD ^u!D

VaD M %

!_ !H A7 "

!_ B
+

a?

pN 0
\!U R;

!`) " `

` %`B!-

`D!F VaD > ) Q a < >

V`aD > `) m Q a < R; " "


R ; R; TIF G !C9

! k 9!9

set [5,5] Q a < %

%f

,- Qd " " ^"


!_ +_ A7 "

, d ) s > ! B G TIF

Q a < I$
set R; Q a <

+S "

\!U

"

,]

"
' T ?B % "
!` *9 600*400 `

R; 0

)" !_ j C
r"

R; T `)" = `2
m`

9 ` ,CD R; >

` ; ` h =!F +_ T) d

1] >

d !F R; "

!` `

! M T) d

! picturebox M

+ 9 ?B M ,B

" =!F >

T ?B y ! 9 44#44 VaD M T ) d

QCD G = 2 0 Q _

Bitmap bmp = new Bitmap(600, 400);


private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 600; i++)
{
for (int j = 0; j < 400; j++)
{
bmp.SetPixel(i, j, Color.White);
}
}
pictureBox1.Image = bmp;
}

B G >!
!

)"

B% ? o )

T )" !_ picturebox "


^! 0 B N "

,B

VaD
VaD

!` " `d T`

`? T `)" = `2 VaD >

y` ! 9 R; 0 : M

+ @AB G

9 ,CD R; 0 " 1+

VaD R"!B kK+? > ! %


T ?B

FU

T 9

B" ""

Graphics

AB

@AB G = Q t+

,_>) B0

! 0 B T ?B

Bitmap bmp = new Bitmap(600, 400);


Graphics g;
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 600; i++)
{
for (int j = 0; j < 400; j++)
{
bmp.SetPixel(i, j, Color.White);
}
}
pictureBox1.Image = bmp;
g = Graphics.FromImage(bmp);
}

%`

> !`

`S " `
T ?B

" `) !` *+ G` 0 `

1] " M$ B Q t+
" 1+

Q7 > $ M @

pictureBox1_MouseMove

T ) ` !_ R; "

"

"

0 ^x,yN

G & K+f B T ?B

r"!B T ) d " 1+

%B!- T ) d

1] & K+f R" ;

y! 9

CD ! *+ "

> ! ^0 & ] "N!P " "

int x, y;
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
x = e.X;
y = e.Y;
}

Graphics@AB

R; &

U 9

?B

)O

I;

B%

>!
"> 1n

0 ` ` !`< `9 Q t+ ` M
r! 0 B Q7 T ?B

+ G

B B T ?a

" 2 R; 0 @AB M B %

" 1+

1,+f 8 9 > " @AB G

$ = B !) a?

FillRectangle

SolidBrush

! T ! h -

+ 0

a? > !

7 G

"

S %

fS"

int x, y;
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
x = e.X;
y = e.Y;
SolidBrush sl=new SolidBrush(Color.Red);
g.FillRectangle(sl, x, y, 5, 5);
pictureBox1.Image = bmp;
}

?B

?B !

0 G! ? % R < : !

>!

a " " P

: !

a? > ! T Oa j C
" " OF @

+_

Oa

+ " P

1] >

a? > !

dM T) d

MouseUp

R < t

MouseDown

+ "! @

+_

private void pictureBox1_MouseMove(object sender, MouseEventArgs e)


{
x1 = e.X;
y1 = e.Y;
}
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
x2 = e.X;
y2 = e.Y;
}
int x1, y1, x2, y2;
private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{
Pen pn = new Pen(Color.Blue,2);
g.DrawLine(pn, x1, y1, x2, y2);
pictureBox1.Image = bmp;
}

a?

s T

>!

private void pictureBox1_MouseUp(object sender, MouseEventArgs e)


{
Pen pn = new Pen(Color.Blue,2);
g.DrawEllipse(pn, x1, y1,x2-x1,y2-y1);
pictureBox1.Image = bmp;
}

T ?B

QCD Qa >

"! H = 2

@ %

@ i$ CB" OF

private void pictureBox1_MouseUp(object sender, MouseEventArgs e)


{
if (e.Button == MouseButtons.Left)
{
Pen pn = new Pen(Color.Blue, 2);
g.DrawEllipse(pn, x1, y1, x2 - x1, y2 - y1);

d !H

pictureBox1.Image = bmp;
}
}

)"

jd!$ >

public partial class charkhesh2 : Form


{
Graphics g;
private int a = 20, b = 300, c = 100, d = 1, ee = 50, f = 1;
public charkhesh2()
{
InitializeComponent();
}
private void charkhesh2_Load(object sender, EventArgs e)
{
g = this.CreateGraphics();
}
private void timer1_Tick(object sender, EventArgs e)
{
GG();
a++; b--; c += 3; d++; ee++; f += 2;
if (c == 700)
{
timer1.Stop();
}
}
private void charkhesh2_Paint(object sender, PaintEventArgs e)
{
GG();
}
public void GG()
{
Point[] destinationPoints = {
new Point(a,b),
new Point(c,d),
new Point(ee, f),
};
Image image = new Bitmap(@"22.jpg");
g.DrawImage(image, destinationPoints);
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
}
private void button2_Click(object sender, EventArgs e)
{
g.Clear(Color.Empty);
timer1.Stop();
}

& ]

VaD M B >

r"! H

VaD j C

1] 0 B >

! r

" k B!9 B r

private void button1_Click(object sender, EventArgs e)


{
Bitmap _MBMP = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height);
Graphics g = Graphics.FromImage(_MBMP);
g.CopyFromScreen(0, 0, 0, 0, _MBMP.Size);
pictureBox1.Image = _MBMP;
}

rm

private void Form1_Paint(object sender, PaintEventArgs e)


{
Graphics g = e.Graphics;
g.SmoothingMode = SmoothingMode.HighSpeed;
GraphicsPath gPath = new GraphicsPath();
Rectangle r = new Rectangle(0, 0, this.Width, this.Height);
gPath.AddRectangle(r);
LinearGradientBrush lb = new LinearGradientBrush(r, Color.White,

Color.Black, LinearGradientMode.Horizontal);
g.FillPath(lb, gPath);
}

r VaD R"!B 1

5 !

Br

public void greyscale(Bitmap bmp, PictureBox picBox)


{
BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width,
bmp.Height),
ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
unsafe
{
byte* imgPtr = (byte*)(data.Scan0);
byte red, green, blue;
for (int i = 0; i < data.Height; i++)
{
for (int j = 0; j < data.Width; j++)
{
blue = imgPtr[0];
green = imgPtr[1];
red = imgPtr[2];
imgPtr[0] = imgPtr[1] = imgPtr[2] =
(byte)(.299 * red
+ .587 * green
+ .114 * blue);
imgPtr += 3;
}
imgPtr += data.Stride - data.Width * 3;
}
}
bmp.UnlockBits(data);
picBox.Image = bmp;
}

Allow unsafe M 9 Properties %C _ 0

G
"

>) B& ]

Q w B

! 9 ?B

BR $

code

r b DLL
! de dll kS _ " ?B

` ! " " 1+`

` T ) `d

R !`P " ` +d " `+- T ?B " 1+

I; 0 T 9

`+- T `?B " 1+`

`I ; G+d `

)O h

"

2?

" B !H

! C) " T 0

R; Q`d " 9 1+ > ) @AB 0 T 9

) dll G+d

" B

!_ " 1+ "

?B

" 1+

! "
+_ T 0 "!w

dll

" T )" !_ " 1+ > !

9 `1+ > I` AB > " ^system.CollectionN dll ` "!B -A B


C:\Windows\System32

) ) C)

t C) =!F @AB

%C `_ ` !`H Stack ArrayList @AB ,C 0 "

I ; 0 Q D T+

B "!B ) d " d! ) dll :

?B " 2 ClassLibrary: 0

?B

! 0 ?

! M % F B ) dll G+d > !

T ?B F U

?B F U

fS" =

@AB M R " d 9 ?B o-

MYForm =

=!F M

MyComputer =

class1

@AB M

"!H
using
using
using
using

! m? !+ M

% 8 9 M B ! 0 B A7

fS" $ M " d @AB Qd " "

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace TestDll
{
public class MyComputer
{
public string mas()
{
return "my name is ...!!!";
}
}
}

8 9 T) @AB T)
r

? CB" > !

!0 B

public C+- B

+ "

" " !_ VB % a9 M

9 +a G

CB" M =!F >

private void button1_Click(object sender, EventArgs e)


{
MyComputer mc = new MyComputer();
textBox1.Text = mc.mas();
}

"

{ d

! 0

-"

" `d M ` " " `) 0

+d
"

C dll 9
` "!

DLL Q F

Build "!B %
! "

M ,B

" 2 2; "

! = >

! B >!
?B ! de

c !< a? > ! T ?B " 1+

` ?B M ,B

Add references

! !P " " dll G 0 T 9


"!B %

P$ T ? T ) d

M ,B References %C _ 0

?B \ f+

"!B ! de

" B

?B " 2

" d dll Q F

"

r ?B using

! "

FU 9

)=

using TestDll;

r 7

?B " 1+

)G

,d " > ) @AB 0

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TestDll;
namespace WindowsFormsApplication44
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MYForm mf = new MYForm();
mf.Show();
}
}
}

)" ! *9 Qa G

?a F U

)=

d !H

private void button1_Click(object sender, EventArgs e)


{
TestDll.MYForm mf = new TestDll.MYForm();
mf.Show();
}

CEDCThreading

`) R; T `9 ` ` P$ % ` $ `) "!9 = I1 a? T 0 "!<
` R"!`B >0

- " +_ A7

?B ! T)

` 9 ` S !) " cpu S
` S !`) " cpu %`
%D!` R $ ?B
Q D T+

BG

" ' "! H

)G

1n

B%

`2 ; 0 `B

>
`a

%OH!

` ?` ; !+O` `) "!`9 = `I1

"

8 9

! > ? % S G

% " 0

?B T

9 )

"

"_

! G

?B

i 9

GaC

+ "M
cpu > !

cpu %_

Threading0

t C) R $ "

L!< ? T
S7

R C) + ) S

P$ a? V< ) = 2

P$ T ? T ) d

+_

%C _ G "

; j < C > ! h - 9 T ?B !+?B

z !p 0 T)
=2

+S T+

+` " `?$ R C) T 9

` ! G`

! G ?$ B

L H ! ,<

t? C) 8_

T) 0

ID !

T`) `

)"

) "!9 kS

P$ B %

" 1+

a? "

%C _ G
) "!9 !H T ?B !

+ " L!< B 9 S " !P "

h - +F!P = 29

"

C) T) & ] G "

1"

+F!H = 2 L!<
T
r

'T)

%S

a? !P

) =2

Q F " R"!B wB QCD R C) B

r ?B F U

!0

) " +

? >

7 G Q- > !

using System.IO;
using System.Threading;

T ?B
!_ =!F >

" 1+ Q F R"!B wB > !

BinaryWriter

! groupBox " radioButton

BinaryReader@AB

" 0 io

progressBar " a? = 2 > !

= P?) " ! H !_ !+?B G Qd " ) radioButton !H B % ? groupBox B0


"

) "

) radioButton 0
?B T ?9 Qa z t

a
) !+?B

)"
F!

9 B % ? @AB " G
"!9 @AB R $
=

T ?B

" 1+

?) = 2

B T ?B

y ! 9 "!9 @AB 0

> "!

wB QCD B T ?B

? G C) > ! >!P " @AB 0


T ?B

" B% & ]G

y ! 9 Qa T) 8 9 " V< ??B !


?B !

kK+? "!9 @AB


T

BL

start

8 9
@AB G
CB" > !

Thread t1, t2;


double spead = 0.05;
private void button1_Click(object sender, EventArgs e)
{
ThreadStart ts2 = new ThreadStart(Copy);
ThreadStart ts3 = new ThreadStart(Copy2);
t1 = new Thread(ts2);
t2 = new Thread(ts3);
if (radioButton1.Checked)
{
t2.Priority = ThreadPriority.Lowest;
t1.Priority = ThreadPriority.Highest;
}
if (radioButton2.Checked)
{

C T +

ThreadStart

!0>) B

t1.Priority = ThreadPriority.Lowest;
t2.Priority = ThreadPriority.Highest;
}
else
{
t2.Priority = ThreadPriority.Highest;
t1.Priority = ThreadPriority.Highest;
}
spead = Convert.ToDouble(textBox1.Text);
t1.Start();
if (checkBox1.Checked)
{
t1.Join((int)numericUpDown1.Value * 1000);
}
else
{
}
t2.Start();
}

"!9 B : ! > ! "!9 Start + !

%
"

R;

+_ T ?B

" 2 > 1_

" 1+

wB > I 9 " L

G0 "
T ?B

T "!B fO B
Q F ?B " 8 9 "

)O

% S

C ! M9 9
td M " ? %
!

?B

B 2+ 9T)

I, F B % ? I 9 G
fO > I

) "!9

B T

wB %D! T ?9 > ! !P " > ) B


p

" "!9 R $ "

" 1+

1_ " 2 "!9 !P " > ) B ,C 0


T "!B G 9 B 9

J ?$ &

% R a B

Q F " j 0; = 2 > ! ?B

wB

> 1_ 9 T "!B
8 9 ">) B
fO
)" !_

public void Copy()


{
int NumRead;
long FileLength;
FileStream From = new FileStream("1.iso", FileMode.Open);
FileStream To = new FileStream("3.iso",
FileMode.CreateNew);
byte[] buffer = new byte[1024];
FileLength = From.Length;
progressBar1.Minimum = 0;
progressBar1.Maximum = (int)FileLength;
while (FileLength > 0)
{
System.IO.BinaryReader Reader = new
System.IO.BinaryReader(From);

K
!

NumRead = Reader.Read(buffer, 0, 1024);


FileLength = FileLength - NumRead;
System.IO.BinaryWriter Writer = new
System.IO.BinaryWriter(To);
Writer.Write(buffer, 0, NumRead);
progressBar1.Value = progressBar1.Value + NumRead;
Writer.Flush();
Thread.Sleep(TimeSpan.FromMilliseconds(spead));
}
From.Close();
To.Close();
if (progressBar1.Value > 99)
{
progressBar1.Value = 0;
MessageBox.Show("Copy Finished successfuly");
}
}
//////////////////////////////////////////////////////////////////////////
public void Copy2()
{
int NumRead;
long FileLength;
FileStream From = new FileStream("2.iso", FileMode.Open);
FileStream To = new FileStream("4.iso",
FileMode.CreateNew);
byte[] buffer = new byte[1024];
FileLength = From.Length;
progressBar2.Minimum = 0;
progressBar2.Maximum = (int)FileLength;
while (FileLength > 0)
{
System.IO.BinaryReader Reader = new
System.IO.BinaryReader(From);
NumRead = Reader.Read(buffer, 0, 1024);
FileLength = FileLength - NumRead;
System.IO.BinaryWriter Writer = new
System.IO.BinaryWriter(To);
Writer.Write(buffer, 0, NumRead);
progressBar2.Value = progressBar2.Value + NumRead;
Writer.Flush();
Thread.Sleep(TimeSpan.FromMilliseconds(spead));
}
From.Close();
To.Close();
if (progressBar2.Value > 99)
{
progressBar2.Value = 0;
MessageBox.Show("Copy Finished successfuly");
}
}

?B

wB

R;

+- ) = 2
+

P?

Q F0 %

wB QCD +

, B M S !) " B % & ] G

d B%

B = > sF 0 !+CB " 1+

, B ?$ !)

2+

8 9 BL

"! H

= 2 Q F R < 9 a?

) O >! B G

" S

?B wB

0 " 1+

Thread.Sleep(TimeSpan.FromMilliseconds(spead));

" O ! cpu %D! T


A7 T ! H

! 9 T "!B " 2

J ,

! " !+?B G > ! TC B M B % & ] G

!1] 0 !H A7
?B

?B

k ?+

dM

! C+- ?B
" 1+ "!9 0

9R

!<

progressBar

" 1+

T ! ]" D

progressBar

?$ &

R"!B F U

R " d Qd " " ) !+?B G R $ ) error

BL

progressBar

L" d

) !+?B 0

! " >! d 9

progressBar

!H

?B

3444

9 T ?B : !

B ) "!9

+_ r +a

! 9 ?B ! Ctrl+F5
??B

S !
> I, F

^word,txt,pdfN ?

?+ > I, F A7

"!B

^bitmap,jpg,png,gifN ? >! K9 > I, F

B >" 0 > I, F

+"hg"
h- 9

^mp3,divx,mpegN ?

9 ;

"" j C
S

>0

P$

+d

"!OF mp3 ? H

T 0 "!w >! H" gt


I?

B > $ R;

! 0 VaD "

" )v G
! de

P$ I, F G
?

T) d
+d

C+- " d R + H

9 ; S

>0

"!OF C,B

jf G " ' $ ? >0

"!OF = I1

>!? > ) B ,

9 k,t G !+I " > ! %


bmp % !F >!P "

B "!B !aF G

I ; >0

exe

! Q F +- I, F C)

! de

! de jpg % !F

?B
a B T?B

C+ T) 0
k,

!9

" % F!n

?B

9 I ; % F!n

H ) bmp % !F VaD " I ; >0


Q a < VaD bmp " %

"!B

?B P ) VaD

9 [0,0] Q a < 0 A7 %
a [100,100] t
> ! QB " ?B
! de "

>0
L

B T+1H

>!

& ]G

? T) >
!H A7

"!B 0

R;

>0

a?

G ?$

??B 0

jpg " + S N' T "


? ; !+I

* >!+CB > sF B T?B


T ?B

! de + !F

R; 9 T "!B ! de

?B ! de R; "

R; B T
" d=

? >
+d

P$

! de

d 0 B T P >0

< a h-\ d

?B
!

T ?B ! de a

Q a < 4444 G >0

! de L

B"

)" j C
% a9 M "

G TIF > ! ?B

> sF " Q a <

> ) Q a < [100,100] 9 !1]

7 G ^%

% !F R; B T

P$ jpg Q F B T

"!OF

! de Q a <

9 S

; C) T "

, B 34 " - + F!n

1,+f > ) % !F B % Qa G

+F!P = 2 >0

^R C ;NVaD >h

S !!

) Q a < C) B " " 9 !U $ h - \ d [100,100]Q a <

a, T?B C ! de L
Qa

k, VaD " !)

; m

B 9 ] " S T "0

"!OF = I1

! & 19 G Q S" %

sF M Q a < !) ? %

sF % . Q a < !) !H A7 %

0 % 64 " - + F!n

?+ ) a VaD " !) !) n "

"!OF jpg " S %

F - "

!H T?B

""!H

+F!H = 2 >0

!F s_ jpg " S %
B CIF

! de

!H

! de >!P "
+_ r

9 "! H

? " C R !P " R $

! T 9

^merN

! de

< Q FM r

' )" j C VB
>!

System.IO.BinaryWriter

0 " d>)

@AB " G

BL

)% 0 >
R $T f %

System.IO.BinaryReader

" @AB " G "

" ^Q F & KfO R" " > !

;M "R
?$ %

" 1+ Q F " 2

d >! $

G+

?$ $ B " " R " d

G+

@AB "0
>!

a? = 2 > !
Q F0 R

F System.IO.FileStream

>! $
P+

0 @AB M

Q F & KfO B % & ] G


;

p h - )"

!_ )!+B B

T ) f !H h - VaD!
! de

T
"

T? 9

T) = 2 I; >

" ) !+B B 0 >

9 ,CD T f a9 a9 B % 0
R; +

T ?B ! de Q F M "

" 1+ .TocharArray + 0 ) !+B B 0 >


G ! ? ??B

sF % M x d ) !+B B 0

! de CB" > !

fS"

< =

= Q7 +

s
M

m? !+ M Q 9 > ! T ?B

,P !+B B !) r +a

T ?B ! de % :
%

) %_

"

R; ?CU Q 9 M

Q F M " ! de Q B B ! 0 "

private void button1_Click(object sender, EventArgs e)


{
System.IO.FileStream _FM = new System.IO.FileStream("test.mer",
System.IO.FileMode.Create);
System.IO.BinaryWriter _BiWr = new System.IO.BinaryWriter(_FM);
string Str="Masoud";
char[] _CH = Str.ToCharArray();
_BiWr.Write(_CH);
_BiWr.Close();
MessageBox.Show("Finish");
}

r! 0 B Q7 "

?B 0 notpad M "

_!F ) B ?B ! de

?B % 0

d !H

;M

"2 C Q F

Q 9 +

d !H

private void button1_Click(object sender, EventArgs e)


{
System.IO.FileStream _FM = new System.IO.FileStream("test.mer",
System.IO.FileMode.Create);
System.IO.BinaryWriter _BiWr = new System.IO.BinaryWriter(_FM);
string Str="Masoud";
char[] _CH = Str.ToCharArray();
byte[] _BY = new byte[_CH.Length];
for (int i = 0; i < _CH.Length; i++)

{
_BY[i] = (byte)_CH[i];
}
_BiWr.Write(_BY);
_BiWr.Close();
MessageBox.Show("Finish");
}

)" j C

?B 0

>!

Q FG

BT

>

private void button2_Click(object sender, EventArgs e)


{
System.IO.FileStream _FM = new System.IO.FileStream("test.mer",
System.IO.FileMode.Open);
System.IO.BinaryReader _BiRe = new System.IO.BinaryReader(_FM);
byte[] _BY = new byte[1];
int j;
string str="";
while ((j = _BiRe.Read(_BY,0,1)) > 0)
{
str += _BY[0].ToString();
}
_BiRe.Close();
textBox1.Text = str;
}

"

" " j C ^>!? N " D & ]

> ) !+B B T "

A7 "

! de ^>!? NM !1] & ]

!9 w B "

% "

R; >!?

% "

I; "

"

?B .! T

9 S +

?B F U !H k 9!9 G C)

=2

?CU Q 9 R $ S

$ C) T +1H B

/ " D +_

B%

t C) r +a
^a=97N!+B B

% b=98 !+B B ^ 01100001N%F

) d

" ; ) d

"

Q 9
r T ?B

o !-

?B TB 9 3. !+B B !) 0 !H r +a

u D Qa G

B ?CU Q 9 M h -

private void button2_Click(object sender, EventArgs e)


{
System.IO.FileStream _FM = new System.IO.FileStream("test.mer",
System.IO.FileMode.Open);
System.IO.BinaryReader _BiRe = new System.IO.BinaryReader(_FM);
byte[] _BY = new byte[1];
int j;
string str="";
while ((j = _BiRe.Read(_BY,0,1)) > 0)
{
str +=((char) _BY[0]).ToString();
}
_BiRe.Close();
textBox1.Text = str;
}

h-

?B 0

Q F& +

Q F
+

H"

H"

VB!) " > "

VB !) !P " B ^>! H" > ! N T !

B M T"" = 2 h - 9 B > B
B

> "

M T) d
?

?B P %_"
T ?B M

!H

% a=01100001 !+B B

% R;

7 u!F ! !H G ! ? % !1]

"> $"

0 Q F +_ !P " & ] G "

,P o !- "

"h

,P !+B B .# C) !d; %
!P " > ) !+B B

" B
B

t C)
CIF

Q 9 ) !+B B G !P "

T ?B

!1]

"

!d; % R; T ?B 0

Q FT) d

R " d +_

T "!B ! de
T !

) R; R

d 8_

" T ?B

or ,and Q] -

!H

^ N OR ^10000000=128N
% "

9 T ?B

B"

,] !+B B

C
9

I ; C) !d; % R"!B M > !

^&NAnd ^01111111=127N

T " ;

I ; Q] - ! 0

"

r )" ! *9 Q

? ;

,_ B -

private void button1_Click(object sender, EventArgs e)


{
System.IO.FileStream _FM = new System.IO.FileStream("test.mer",
System.IO.FileMode.Create);
System.IO.BinaryWriter _BiWr = new System.IO.BinaryWriter(_FM);
string Str="Masoud";
char[] _CH = Str.ToCharArray();
byte[] _BY = new byte[_CH.Length];
for (int i = 0; i < _CH.Length; i++)
{
_BY[i] = (byte)(_CH[i] | 128);
}
_BiWr.Write(_BY);
_BiWr.Close();
MessageBox.Show("Finish");
}

CIF C

$ ) !P " ?B 0

Q F

B !H !P "

r )" ! *9 Qa G

j C B -

private void button2_Click(object sender, EventArgs e)


{
System.IO.FileStream _FM = new System.IO.FileStream("test.mer",
System.IO.FileMode.Open);
System.IO.BinaryReader _BiRe = new System.IO.BinaryReader(_FM);
byte[] _BY = new byte[1];
int j;
string str="";
while ((j = _BiRe.Read(_BY,0,1)) > 0)
{
str +=((char)( _BY[0] & 127)).ToString();
}
_BiRe.Close();
textBox1.Text = str;
}

S
R 9" d
h

d !H " Q F R"!B

" !H A7 > P

> ! T)

D
>0

a, "

>0

"!OF > ! T)

"!OF T "!B Q- h
" I?O <

7 " B> $
) T+

PS

R ?D

B T)"

gU 9

FN r ?B QCD & ] >

= 2 >0

"!OF

^ % R 9" d
% G !d; "
% %1) "

a !+B B %O) !) " T 9


r !+B B

% !1]

computer %

. b Qa

?B o-

ID! G !C9

,P > ) !+B B C) !d; % R $

& ]G

r!+B B

!H A7

?B ! de

?B ! de compute !+B B !)!d;

. b
r> P
G

> ! T) >0

) =2 & _% I

"!a,CD

! T+

O : !+d
PS

T )"

BG

Rijndael

Rijndael

T+

"!OF > ! T) " " "

0 !+I

PS G
T "0
r ?B a "

@AB
C+

" d G+ R"!B

PS ) R ?B 9

+ .6#
G

" ; @AB G ?$

Rijndael

>!

: !+d

T+

?B

PS 0 " 1+

?B " 2 .6b Qa & ]

7 >!
" T+

B% & ]G

T) R"!B a " > !

"

PS

T+

PS G

"

G+

?+ M r

! Qa

9
R;

?a ^ + .6#N^ + 3.N %F " C_ 3.


9 T) R"!B a " = P?) "

R;

! G

=2 G < " "

B T +F!H ! " !1] C) > !


' ?B "

Qa

G+ > !

2?

" ?)

R C) T) a " = P?) " B ?B


r

t C)

m? B & ,CD
=2

R;

"!a " & ,CD

9 +a G
?

" B

CB" > !

)" ! *9
! B

using System.Security.Cryptography;
using System.IO;
private void button1_Click(object sender, EventArgs e)
{
Rijndael RJ = Rijndael.Create();
string strRamz = textBox1.Text;G
#!* * 4 !3 ;
string StrMatn = richTextBox1.Text; H" G
string FileName = "CText.txt";8
* G 8J6I 4 !3
char[] _ch = textBox1.Text.ToCharArray();
3
byte[] _by = new byte[32];
for (int i = 0; i < 32; i++)
{
_by[i] = (byte)_ch[i];
}

)
3 ;

byte[] _byIV = new byte[16];for vector(16 byte need)?


for (int i = 0; i < 16; i++)
{
_byIV[i] = 0;
}
RJ.Key = _by;
RJ.IV = _byIV;
EncryptTextToFile(StrMatn, FileName, RJ.Key, RJ.IV);
MessageBox.Show("finish");
}

B> "

! Q F ?B " CText.txt =

"

d !F

Q FM >

EncryptTextToFile

B ?)

G+ ! de CB" "

=2

R"!B a

1n

,]

r[1] % ! 0
public void EncryptTextToFile(String Data, String FileName, byte[]
Key, byte[] IV)
{
try
{
// Create or open the specified file.
FileStream fStream = File.Open(FileName,
FileMode.OpenOrCreate);
// Create a new Rijndael object.
Rijndael RijndaelAlg = Rijndael.Create();
// Create a CryptoStream using the FileStream
// and the passed key and initialization vector (IV).
CryptoStream cStream = new CryptoStream(fStream,
RijndaelAlg.CreateEncryptor(Key, IV),
CryptoStreamMode.Write);
// Create a StreamWriter using the CryptoStream.
StreamWriter sWriter = new StreamWriter(cStream);
try

{
// Write the data to the stream
// to encrypt it.
sWriter.WriteLine(Data);
}
catch (Exception e)
{
MessageBox.Show( e.Message);
}
finally
{
// Close the streams and
// close the file.
sWriter.Close();
cStream.Close();
fStream.Close();
}
}
catch (CryptographicException e)
{
MessageBox.Show( e.Message);
}
catch (UnauthorizedAccessException e)
{
MessageBox.Show( e.Message);
}
}

r R; 8 9

!C) j C CB"

% 5 ! !0 B

private void button2_Click(object sender, EventArgs e)


{
Rijndael RJ = Rijndael.Create();
string strRamz = textBox2.Text;
string FileName = "CText.txt";
char[] _ch = textBox2.Text.ToCharArray();
byte[] _by = new byte[32];
for (int i = 0; i < 32; i++)
{
_by[i] = (byte)_ch[i];
}
byte[] _byIV = new byte[16];
for (int i = 0; i < 16; i++)
{
_byIV[i] = 0;
}
RJ.Key = _by;
RJ.IV = _byIV;
richTextBox2.Text = DecryptTextFromFile(FileName, RJ.Key, RJ.IV);
MessageBox.Show("finish");
}
public string DecryptTextFromFile(String FileName, byte[] Key, byte[]
IV)

{
try
{
// Create or open the specified file.
FileStream fStream = File.Open(FileName, FileMode.Open);
// Create a new Rijndael object.
Rijndael RijndaelAlg = Rijndael.Create();
// Create a CryptoStream using the FileStream
// and the passed key and initialization vector (IV).
CryptoStream cStream = new CryptoStream(fStream,
RijndaelAlg.CreateDecryptor(Key, IV),
CryptoStreamMode.Read);
// Create a StreamReader using the CryptoStream.
StreamReader sReader = new StreamReader(cStream);
string val = null;
try
{
// Read the data from the stream
// to decrypt it.
val = sReader.ReadLine();

}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
finally
{
// Close the streams and
// close the file.
sReader.Close();
cStream.Close();
fStream.Close();
}
// Return the string.
return val;
}
catch (CryptographicException e)
{
MessageBox.Show(e.Message);
return null;
}
catch (UnauthorizedAccessException e)
{
MessageBox.Show(e.Message);
return null;
}
}


> +

+_

? % %OH! Q _ T+

%OH! Q _ B " " "

IC+

! hash B %

"

! B%

?$ C

?$ C

?+

%OH! Q _ a?

" md5 T+

) %

"

= 2 Qa G

" " "!F

+_

"

R;

1] ] ?$ \ +B M !H
!) ?

PS G

>

"!F

?B " 1+ R; 0 %

!K ? ) B G

"

" C

R $

>!

" RAD C

I & 29 " " O

B md5 T+

?+
"!H
S

"!H
+_ A7

! de )

B C

% rijndeal md5 T+

"!B B

+-

0 T) ) " d +- "
,_

PS r +a

" B ^ MD5) ?

sD ) %

" = % J = P?) A _ B >

"

7 " B C+

+_ T+

DAp C

S + 2 " > ) s T) M !+aS

)O h

"

) %

" !F

"!B a "

BM +

& ]

G! ?

> +

!K ?

? " ! ! !H
B

PS G

" K_ C

> B R C) "!

md5 & ]

R;

) T+

PS

% % " C
S 9

PS

PS M

0
"

9
B "

!
PS 0

PS 0 " 1+

9 ,f

"!B
;"

? "! H

M !0 B "r

private void Form1_Load(object sender, EventArgs e)


{
string input = "Computer";
MD5 md5Hasher = MD5.Create();
byte[] data =
md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));
StringBuilder sBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));
}
textBox1.Text= sBuilder.ToString();
}

BN

>"

B +
"

?B QCD ! 0 B Qa

" " %OH! true

" ! ! !H

T)

"

>!
^"

bool verifyMd5Hash(string input, string hash)


{
// Hash the input.
string hashOfInput = getMd5Hash(input);
// getMd5Hash L 3 # M )!

K3 ,

// Create a StringComparer an comare the


hashes.
StringComparer comparer =
StringComparer.OrdinalIgnoreCase;
if (0 == comparer.Compare(hashOfInput, hash))
{
return true;
}
else
{
return false;
}
}

S
"

R;
QC-

?B " 1+

Q F R; 0 = S 8_

! Q F !C) ! "

> I, F B & ] G
Add New 0

> I, F

" 9

?B F U

=2

a?

!
!
+_

^SetupN kK > ) Q F %d

a? = 2 > ! T ?B

F U !P "

Q FM

; D O
d %_ !)

?B ! de Resource File
B G TI > )"! B 0

! M "

?B F U

6 +

! !C) > I, F !P "

a "
!

Resource File M Item

^3N
Add

Add Resource %C _ 0

^. N
0

"

^ N

> ) Q F Resource1.resx !2?< 0


?B F U

Existing File

?B F U

VaD " A7

FU B
!

I, F

%K R + !

+_ 9 ^ )" ! *9 kK

! Q F % F!n "!B Q w B

R; % a9 N )" !_ =!F >


r"

> ! a? !P "
" )"

fO9 VaD & ]

mp3 % !F

! de

wB F - 0
!

" ) VaD 0

! de I+ 0 >

a?

+_

j F
a

"!B

"!B M ,B R; >

;& ]

" VaD C Q F !H
?B

"" = 2

! CB" M

Q F " I+ 0 >

R;

!P " Q F M R + > !

I, F G r +a N

7 >!

+d ?

;& ]

& ] G !~
^ ?B F U

private void button1_Click(object sender, EventArgs e)


{
try
{
byte[] _MYFile =
WindowsFormsApplication56.Resource1.TRACK_01;
Bitmap mypic =
WindowsFormsApplication56.Resource1.Chrysanthemum;
System.IO.FileStream _FS = new
System.IO.FileStream("D:\\T1.mp3", System.IO.FileMode.Create);
System.IO.BinaryWriter _WR = new System.IO.BinaryWriter(_FS);
_WR.Write(_MYFile);
_WR.Close();
mypic.Save("D:\\mypic.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg);
MessageBox.Show("finish copy");
}
catch { }
}

"!B T ) d v System.IO ,d " > I AB !P "


F - 0

" %C _ G "

a 0 I, F wB > ! " " !_ File @AB " B + G 0 r System.IO.File.Copy


"

r T ?B

wB d

" 1+ !P " R a

"0

aD r

private void button1_Click(object sender, EventArgs e)


{
System.IO.File.Copy("c:\\pic.jpg", "d:\\pic.jpg");
}

r 7 "

" 1+

+ G 0 Q F R"!B < > ! r System.IO.File.Delete

private void button1_Click(object sender, EventArgs e)


{
System.IO.File.Delete("c:\\pic.jpg");
}

!H "

" 1+

+ G 0

" ""

Q F M a? R CIF > ! r System.IO.File.Exists

VaD!

"!H

! true

+ G % ""

, F
r

private void button1_Click(object sender, EventArgs e)


{
if (System.IO.File.Exists("c:\\pic.jpg")==true)
{
MessageBox.Show("file is exists");
}
}

?B

QCD wB Q7 !P " >

0 Q F M R" " %B!- > ! r System.IO.File.Move


"

"!B T ) d Q-

G " S7 A_ B"

" ,B 7 ,
" 1+

" '"

?+ > I, F " G+

" 1+

< ,] Q F B & 19 G
I, F = ! *9 > ! + G 0 r +a

> ! rSystem.IO.File.WriteAllText
T "!B Q-

"

" 1+

+ G 0 !

M "

S F " 2 > ! r System.IO.Directory.CreateDirectory


r

private void button1_Click(object sender, EventArgs e)


{
System.IO.Directory.CreateDirectory("c:\\myfolder\\jk");
}

: System.IO.Directory.Delete

"
" 1+ !

M R " > I, F R" ; %

" 1+ !

>! + G 0

R"!B < > ! + G 0

System.IO.Directory.GetFiles

7 "

private void button1_Click(object sender, EventArgs e)


{
string[] str=
System.IO.Directory.GetFiles("c:\\myfolder\\jk");
foreach (string i in str)
{
listBox1.Items.Add(i);
}
}

fO !

" .exe

I, F r

7 T ?B " 1+

+ G 0

2+

>! T 9

G ?lC)

private void button1_Click(object sender, EventArgs e)


{
string[] str=
System.IO.Directory.GetFiles("c:\\Windows\\System32","*.exe");
foreach (string i in str)
{
listBox1.Items.Add(i);
}
}

r
= C9 "

wB

! Q F B

!)

! G
"

" )" ! *9
" " ! *9

I, F 0 >"
fO

<

r )" ! *9 .#b Qa & ]

< B

? >

! Q FG
R; Qa

?B > I, F

! G = 2 >!

.#b
r

? start CB" > !

!0 B

{
string x;
string io = System.IO.Path.GetFullPath("changeExtention.exe");

0 !P
!. 7 #
!>
O
*
J/ ) N getfullpath 0
R c:\\newfolder\\changeExtention.exe
&#
7 )
3 8 !Q
O !67 O !3 3 T
'3
3
J/ O
H6 # 4 SH
<'& 6
'3
3 WM 6 J/
, <' *
UV? replace 2 8# 0
3
)
c:\\newfolder
x = io;
io = io.Replace("changeExtention.exe", " ");
# :'
$

8J6I

=F J/

6 #

3 J/

*J/

3 8 !QF4 SH

string[] _M = System.IO.Directory.GetFiles(io);
O
6 # *
!>
# 6 ;> 3
*
'= )

) N

J'X,

SH

) N

foreach (string str in _M)


{
if (!str.EndsWith("changeExtention.exe"))
{
System.IO.File.Move(str,
System.IO.Path.ChangeExtension(str, textBox1.Text));
}
}
}

rSystem.IO.DriveInfo
"

" 1+ !9 w B > )

" Q B & KfO R" ; %

> ! @AB G 0
r

^ % F!n % !F : N

% "

!9 w B ^C)

" & KfO

System.IO.DriveInfo DF = new System.IO.DriveInfo("C");


listBox1.Items.Add(DF.DriveFormat);
listBox1.Items.Add(DF.TotalSize);

r ?B QCD

]G

!9 w B > )

" & KfO C)

d !H

private void button1_Click(object sender, EventArgs e)


{
System.IO.DriveInfo[] DR = System.IO.DriveInfo.GetDrives();
listBox1.Items.Add(DR[0].TotalSize.ToString()+DR[0].Name);
listBox1.Items.Add(DR[3].TotalSize.ToString() + DR[3].Name);
}

>" @ = ` f +B `
: `U

" 2+

?B

I ; C) R CIF > !

f +B G " ?B kK

R;

?+ ) 8
+

< I ;0 " 1+

>)
kK 8_

f +B

R
9

! "

rUserControl
A7 %

" 1+ !+O

I !F C) > !
G 0 9
"

" 1+

!+?B ?$ 0 =!F !) "

S % !+O I !F C) " G
+ " =!F

) !H B "

a? > ! >!P " Q-

R; 0 & 1] C) "

"!B " 1+

T ?B

" " !_ 0 "

G! ? %

% " R; 0

?B 8C T)

F!] A]

! M " =!F G ?$ ?B u!F


" D ?$ B " " 0 =!F !)
> ) !+?B
BG

" D " 8C > ) B


B ?B % " ) !+?B

a B % UserControl 0 " 1+ L
T ?B

?B add

R; New Items %C _ 0 % F B UserControl

R; B
" 1+
B >!

r! 0 Qa z t

)" !_ R; >

0 "

> ) !+?B

? CB" > !

" D " 8C

B 7 >!

private void Add_Click(object sender, EventArgs e)


{
int i = int.Parse(textBox1.Text);
int j = int.Parse(textBox2.Text);
textBox3.Text = (i + j).ToString();
}

Qa M "

Q w B td R

)" !_ R + I !F >

!H "
Oa

+d
R;

user control 9
"

!) n

" user control =


?

r )" !_ & 1] "

?B Build

2+

? user control

?B !

%D

! r

VB % a9

?B F U

clock =

user control M

, _ G !C9 Q7

)" !_ =!F >

^"

F !C 9 load "Nr

? !C 9 load > !

! !C 9

!0 B

private void timer1_Tick(object sender, EventArgs e)


{
textBox1.Text = DateTime.Now.Hour.ToString();
textBox2.Text = DateTime.Now.Minute.ToString();
textBox3.Text = DateTime.Now.Second.ToString();
}
private void Clock_Load(object sender, EventArgs e)
{
timer1.Start();
}

r )" !_ R + I !F >

! %D M

?B build

>!

"!H

T+

R 0 Q B & KfO

J , 44 !) " B % ? !C 9 B B T )"
+- )" j C

R; "!B ! *9 q 9

^ )" !_ =!F >

DateTime

@AB B % & ] G

!_ !C 9 M T

R 0 !H 9 ^ )" ! *9

! label

Nr ! 0 B Q7

R 0 S!) " a?

! R 0

?B F U

BL

N"

! G

!
q 9

private void timer1_Tick(object sender, EventArgs e)


{
textBox1.Text = DateTime.Now.Hour.ToString();
textBox2.Text = DateTime.Now.Minute.ToString();
textBox3.Text = DateTime.Now.Second.ToString();
label1.Text = "Year : " + DateTime.Now.Year.ToString();
label2.Text = "Month : " + DateTime.Now.Month.ToString();
label3.Text = "Day : " + DateTime.Now.Day.ToString();
}

Windows Media Player in Csharp

0 ? ! ,<

?B \ f+

a? > !

?B jf< ! B > !

choose items

"!B %

M ,B

)" OF

)" !_ =!F >

Oa

R; "

!) n

P?);

! " B

"0 &_

" a? = 2 > !

ok CB"

?B \ f+

)H

?B " 1+

! ,<

" Ga ; M

)" ! *9 none

R; uiMode

?B false

?B jf< k 9!9
m?); " d

=!F R ; h 8_
)" !_

; "

r! 0 B ?

" O " " j C ! ,<


R; Visible " O " " j C

fS" > IP?); 9

" d > ) m?); =


?B jf<

$) +

? =!F load "

?B " 2 string 0 >

?B F U ! ,<

jf< % S

d !H

d !H

!0 B

; a? > !
)" !_

?B

private void Form1_Load(object sender, EventArgs e)


{
string[] strNameof = new string[2];
strNameof[0] = "a.mp3";
strNameof[1] = "b.mp3";
for (int i = 0; i < strNameof.Length; i++)
{
axWindowsMediaPlayer1.currentPlaylist.appendItem(axWindowsMediaPlayer1.newMed
ia(strNameof[0]));
}
axWindowsMediaPlayer1.Ctlcontrols.play();
}

?B jf<
0 %

9AaO > " S

B>

! !H

?B jf<

>!+O > I, F "

>

>)Q FT 9

9 B % ? ! ,<

kK windows media player

! Q D T+

>
"

r +a
a?

?B C
0
kK

?B jf<
>0

^ wavN % !F

9 ] > I, F

" d > I AB

B ?B " 1+

?a " 1+ ! ,<

+-

B +
+

d !H

System.Media.SoundPlayer

r% !0 B & ]

@AB G

BL

,C

@AB

! ,<

private void Form1_Load(object sender, EventArgs e)


{
System.Media.SoundPlayer my = new
System.Media.SoundPlayer("a.wav");
my.Play();
}

?B y ! 9

CD

@AB B p!

?B y_ +

m?); jf<

> CB"

d !H

System.Media.SoundPlayer my = new System.Media.SoundPlayer("a.wav");


private void Form1_Load(object sender, EventArgs e)
{
my.Play();
}
private void button1_Click(object sender, EventArgs e)
{
my.Stop();
}

`? G `C) ` %`
>

& `DAp >0

" d!
! de > !

h % C) 0 I ; >

& ,CD & DAp >0

=0h & ,CD B +- > !

! de

,C 0

! >)R 0

" ; T) !F
> " `B "!`B
0 " 1+`

QB

` `9 T +

?` ; V `B " " P <

V B

R 9

"! P

!_ " 1+ "

jf G " ?+ ) & DAp >0


CB a? Q _

0 !

0 !

9 DAp M

B 9 DAp > Ia

! de > ! h % ?

T )" = 2 V B " " P < > !

k ?

,C 0
)" R 0

& ,CD G
T

?B QCD b.Qa z t % F B .443V B " 9 DAp M M " 2 > !

b.Qa

= ` M` ` ?B fO`
> !` T `?B " 2

R; >0
B

! de Q
R; %

9 DAp M =
?B fO

B"

R; >0
? H>

!< C 0 B G 0
! de !

?B \ f+ R; > !

0 !2?< " % F B B G

Create table in design view

9 DAp M

- !p

M` T+

" A7 T ?B fO

G ""

!t 2O " >"

%` !`+I = ` > !` "

R; " B " O 0 > !2?< ? H G > ! R"!B M ,B


R; :

9 DAp M
!C 2O "

?B M ,B

> ) , F % F B B G > ! T 0 "!<


C

2O " =

? > ) , F PO " 9 DAp

\ f+ int g ] : 0 % !+I 2O " >"

!C
"

C >) ,F

\ f+ +

: 0

.b.Qa
% ` F B ) `, F T `?90 ` T "!`B T ?9
`B G`

?B \ f+ " d

>! = M B "

>) ,F

?B

) O 3b.Qa

" B

t C)

!2?<

!< C 0 !2?< G+ 8_
{ d

=2

3b.Qa
= h- 0

>!P "

C`

"

`
" `d

T ) `f

?B QCD z !p G C)

% " 0 >!P "

" ` ?B M` ,B R; > ! % F B

` > !`

9 DAp

` `a, T `?B "

? ;V B

V B R 0T 9

) O >!

2? C) 0 %

& DAp 2? C)0 B %

" " V `B R ` 0 G+ ` " ` 0 `


R $T

B G`

B T )" = 2

+ "" T ) d g U 9 >

R; " B " " "

O "
G

R + ! !H

F U !2?<

R; " 9 DAp 0 ?) R $ %
o )

?B

)O

Sd

& ! *9

=0h & ,CD

?B

z !p0

QKF " B v

" 0 Q_G ! ?

"!B T ) d B V B R 0 !+O

"

V B !2?< " T "


? H% FB

V B
G

" 9

U 9h-

) O > ! T ?B >0

" <

Create query by using wizard

^ ? ; V B & + " NV B R 0 h -

?B >0

" < R; "

V B R 0

?B \ f+
INSERT

!Be ! "

!0

+ " G+

A7 "

" 1+ V + "

+ " R"!B F U > !

b.Qa z t [1]"

+ "G 0

FU

+ " "

insert into Table1 values"javad",8506678,86,123;

b.Qa

0 >!t R"!B < > ! A7 [1] "

" 1+

0 & DAp R"!B < > !


"

+ "G 0

" 1+ % "

R; =

delete from Table1 where name="javad";

T P A7 T ?B F U R C9 + "
s`

" !`H `B ` ?B ` 9 `

5!
`+a G`

" !F

)O h

` %` " ` R; =

+ " " B

B GB o-

t C) GCU "
0

)!t

Q`B " ` 5!` h `

+ " " !H A7

?)

!_

! "

)!t QB T ?a "
"!B

p! & + "0
<

) !t

UPDATE

u `D

Kf

2O "

C T+

d !H A7 [1]"

" 1+

" ! *9 > !
T ?B

" 1+

+ "G 0

+ " G 0 T ?B

update Table1 set studnumber=123321 where name="masoud";

` T `)" ! *9

R;

T) d

>!K?D !H B T
T )" ! *9

+ "

R;

+a G

T 9 C

T)

G "

\ f+

,B R ?D
SELECT

= ` > `) R +` ! 0

+ " G+

A7 "

" 1+ R CS

) R + \ f+ > !
"

+ "G 0

\ f+

2O "

SELECT name
FROM Table1;

& + " +S "

" 1+

V `B help ` ` 9

,] & + " R ?D
I ; R CIF > !

) R; 0 )

?B " 1+

I; 0

! !+O
9

" B "
B" ""

9 + " )G
>!P " kS
?B

" & +` " G` 0 `B

_ ` + S T "!B

V B "" P <

" B " >!K+f &

U 9 I?

) d ? ; I ; !+O T "!B " 1+

)
# A'3 0 # 4 & Y+*

!
I` AB

" T `?B v`

" V + " > ) @AB "

Q`] SQL `,C 0 !P " > ) " " P < V B " " P <
`I ; >

& ,CD

""

+ ! "

"" P <

T 9

"T) d
I ;0 " 1+

QKF G "
B" ""

& + " B % G I AB G

1n T

C >0
" ` < !` " ` " " `P < > ! T " " g U 9

R; Q _ QKF " B
T ?B

insert
" 1+

+ "T+

" <

d !H A7

) @AB G 0 T ?B >0

System.Data.OleDb

> !`
+F!H

`)" ` = 2

! "

"" P <

System.Data.OleDb

)G

Q] & ,CD B " " "


" B" ""

) @AB V B " " P <

" 1+`` System.Data.SqlClient `) 0 ` 9 `


b3Qa z t [3] ?B F U ) )

FU

) @AB T+1H B
R

t C)
Q]

sql " " `P < ` R ` Q``] > !``

I ; % F B ) @AB G 0 " 1+ > !

?B

B =0h > ) ) b3 Qa

T 0 "!<

) )G

,d " > ) @AB

OleDbConnection

` ` T ` ?
@AB `

& +` " `B G 0 Q _ ? "

`B G` > !` `B

" 1+

"" P <

& + " R" + !F R 0 " +F 19 QCD G

Q] > ! @AB G 0
+_ T

Q] " " P <

T ) `d v`
M` ` 0
`

R;

` ">

%C _ " B )"

=2

" " `P < ` R ` Q`] > !` @A`B G`

" ; R; 0 ` C M ! 0 " % R;

BG

B OleDbCommand" " "

>!P "

oledbconnection @A`B ` T "!`H!

,V +" = Q

- "!B

G % ConnectionString

rV B " " P <

"

5 ! B%

Provider=Microsoft.Jet.OLEDB.4.0;Data Source="C:\db8.mdb";password="456

% .443 A7 %
%C _

?B

$0 G V B :
"2 V +"!

B"

fO Microsoft.Jet.OLEDB.4.0 %C _ "

source %C _ " % & 1+ R; :


"" P < % ?

`B T `P

?B u!F T ?B

"% V +"G
)L

G0
c !< M

B
a

B T CI1 2B0

!0 "" ""

G R" ; %

` ?B " `2

"" `

` 0 ` > !2?< - ?B M ,B add new data source. ? H >


?B M ,B

"

database ? H >

"

B .44/

5 !

B ;j<

`? 0

next

- "!B ! de F -0

!d;

> ! >" 0 > I

"!B " 2 V B V + " M


! data %C _ 0

! .b3Qa z t !2?< G

.b3Qa

" " ` 0 ` 3b3Qa z t > !2?< 9 ?B M ,B new connection ? H >


`? H G` >
>

"

`? H >
? H>
>

!`

!` `

Q] sql

+
+

?B \ f+

d !H

` ?B wB

!` de R; "

R;
G

CB" >

b3Qa z t

?B "
?B

" B"

!2?< "

"" P <

!2?< G

0 >!P " !2?< "!B M ,B

?B M ,B Microsoft Access Database File ? H

V + " Q F "!B ! de R; "

?B M ,B ok

" d ! "

d !H !2?< G

! Add connection !2?< " "!B \ f+


!H

"

` ?B \ f+ change %C _ 0

Q] V B " " P <

1`] " `
`

`+_

)O

V B

+_

?B M ,B Microsoft SQL Server

V +"Q F B ,
R;

?B M ,B browse

password %C _ "

ConnectionString

?B y ! 9 String : 0 ! *+ M % !+I R;0 " 1+ > !


?B " 1+ R; 0

"" V +" Q F
9

!) n

?B " 1+
! " 9 [4] ?B

" " P < : \ f+

1] 3b3Qa

b3 Qa

!F

)O

& 19

)" = 2

!P " > ) " " P < >

M` % ` F B @AB G 0 " 1+ > ! "

" 1+

%`

R; connectionString "

`B `

!`_ > +`

` !!

B G % !+I

P$ oledbconnection @AB G 0 T ?

" 2 ! 0 z t R; 0

=" " g U 9 Q _ %C _ "

R; R" ;

string str = @"Provider=Microsoft.Jet.OLEDB.4.0;Data


Source=C:\db8.mdb";
OleDbConnection co = new OleDbConnection();
co.ConnectionString = str;

%`_ !`) %` =0h `B " " R; G+ `


!P " > ) " 1+ > ! 9 T ?

V `+ " R"!`B 0 > !

R; B = 2 0

T ?B 0

>!P " + " > " @AB G GCU "


R; + T + !1 V + "

?+ ) ! 0 !

> + "T+

+ " " G T ?B " 0;

R;

co.Open;
//insert code
co.Close;

OleDbCommand 3-3

=2
R; 0

BG

B" ""

M B% & ]G

T +` !F `

AB " " P <

& + " R" + !F > ! T +1H , _ %C _ " B

@AB G 0 " 1+

% OleDbCommand @AB G =

R C9 +` " ` T `?B ` kK+? oledbconnection @AB


)"

R O @AB G

t C)

insert

+ " G+

T ?B

)"
"2

R; " B ! 0 B z t

string str = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db8.mdb";


OleDbConnection co = new OleDbConnection();
co.ConnectionString = str;
string str2="insert into Table1 values('nader',42,87,12300);";
OleDbCommand cmd = new OleDbCommand(str2, co);
co.Open();
cmd.ExecuteNonQuery();
co.Close();

"

! de

& ! *9 9 T ?B " 1+ ExecuteNonQuery + 0 C+-

B % G T ?B

R;

B > +a

OleDbDataAdapter 3-4

M` % F B

@AB G 0 " 1+ > ! "

" 1+ DataTable
r! 0 B ? [3]T ?B

R"!B !< > ! !+O @AB G 0


d !F

R; Fill +

?B " 2 R;0

OleDbDataAdapter odba = new OleDbDataAdapter();


odba.Fill(dt);

`$

datatable B CIF C OleDbDataAdapter B % ?

> +` " `$ ` `CI1 `9 T `?B kK`+? oledbcommand @AB


0 !`+H

I;

2O "

B ?B

!<

)!t

V +"

)"

R;
!0

B " B

td

a? > ! ?B !< > $

+ " " A7

?B !<

R CS
(6

string str = @"Provider=Microsoft.Jet.OLEDB.4.0;Data


Source=C:\db8.mdb";
OleDbConnection co = new OleDbConnection();
co.ConnectionString = str;
string str2 = "select * Table1 where (studnumber>85)";
OleDbCommand cmd = new OleDbCommand(str2, co);
co.Open();
cmd.ExecuteNonQuery();
co.Close();
OleDbDataAdapter odba = new OleDbDataAdapter(cmd);
odba.Fill(dt);

DataTable 3-5
G` T `?B ` " 1+` @A`B G 0 T
+` "

+ " R; !] ?D

> !` T ?B !< R;
T

+ "

" 0 %D!

+-

dataGridView
?

"V +"
T 9

?B

T +

0
QCD >

wB M T +
"

;& ]

a? > !
@AB

B % G @AB G !P " > )"! B 0 T

! 0 B 6b3Qa T )" !_ j C

1] "

dataGridView M % F B B G

//Filldt
dataGridView1.DataSource = dt;
?$ + S ?)"

=2

"" T) d g U 9

""
I;

P <

"

5 9 M = 2 > ! =0h & ,CD B "

! " " 1+ 8_

"

QKF " B

""

) @AB ) G
!P " "

@AB 9

!H + " R"!B!< 6b3 Qa


r )" ! *9 ! 0 !

) @AB = % F B

F ?B B sql " " P <

d !H r +a

// SqlConnection
// SqlCommand
// SqlDataAdapter
?B QCD h > ) 7 Q7
r ?B ! de V + "
G`

` ` ! G` "!B `B `

G ?lC) "

=!`F !` 0 " ` !H + "

FU RC

R 2O " & KfO B

?B T ?9 ! 0#b3 Qa z t

`9 `)" ` 0 ` new CB" R"0 ! B "


9

M "

+"

PO " "
"

` M` " " !F % S G ?lC)

>

! r

! >!) n Qa

a? = 2 > !

> 2O " +_

B% & ]

I B % a9 " B
?B <

? >

g K9

> 2O " & KfO


R 2O " & KfO
%

" ;

#b3
?B " 2 project.mdb =
2O` " >"

=!`9

V +"M

H" ` d = `

=`

a? > ! T ?B % "
2O` "

R CS

B ,-! "

C >) ,F V +"G R "

?B % "/b3 Qa z t

/b3
+`

d !`H " `

` ! Q` F `?B

d !F

= G

R; V + " %d

" 9 ?B ! de stud =
)" ! *9

fS"

"

!Be > I

9
r ?B wB

"

% `a9 Q`d " > ) +

F new CB" OF 8_

F )" C = 2
T ?B

y! 9

9 ?B

F ! ~ Insert % a9

]d B BT

V + " > ) @AB

new CB"

?B

<"

CB" + "

5 ! >) B
& ] "

private OleDbCommand cmd;


private OleDbConnection con;
private OleDbDataAdapter da;
private DataTable dt;
private string strcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=|DataDirectory|" + @"\project.mdb";
private void button4_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
numericUpDown1.Value = 85;
textBox4.Clear();
button1.Enabled = true;
}

private void button1_Click(object sender, EventArgs e)

VB

{
con = new OleDbConnection();
con.ConnectionString = strcon;
cmd = new OleDbCommand();
cmd.Connection = con;
@
Z <' 0/
]
# * $\ 'H- ! # ) [
O
4
;
H_ 2 <'&#
) [
* O
&^
aaa<' *
Z 8# # 8
= 3 ;' A1 % `?

F
#!*
= 2 8#
O
3 <'

Z
0
,

4 !3 ! #
3 1H3 <' *
* /

cmd.CommandText = "INSERT INTO stud


(studnumber,name,family,term) VALUES ( @studnumber,@name,@family,@term)";
cmd.Parameters.Add(new OleDbParameter("@studnumber",
OleDbType.Numeric)).Value = Convert.ToInt32(textBox4.Text);
cmd.Parameters.Add(new OleDbParameter("@name",
OleDbType.Char, 50)).Value = textBox1.Text;
cmd.Parameters.Add(new OleDbParameter("@family",
OleDbType.Char, 50)).Value = textBox2.Text;
cmd.Parameters.Add(new OleDbParameter("@term",
OleDbType.Numeric)).Value = numericUpDown1.Value;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}

FU

! G
r"

\ d 5!
Q- ! 0 B

?$ ? T ?B
B

!+I

BG T! >

> ) B !

a? 0 A _

S d R ) VB % a9 & DAp R"!B F U 8_ h

9 T ?B

if (textBox4.Text != "" && textBox2.Text != "" && textBox1.Text != "")


{
bbbbbbbbbbbbbbbbbbb<'0

* L 3 4 &

Q
}

= 2 > ! B % "!F
> !`a9 !H 9 "

!K ?
!

2O "
> 2O "

C R $ ?B "
C R; " B T

> !a9

2O "
,-

C ! B
=

8 9M

) %OH! .%

a?
"

if (MySelect("select" + " " + "studnumber" + ",name" + ",family" + ",term" +


" " + "from stud" + " " + "where studnumber=" + textBox4.Text) == false)
{

=2

R; >

! `B `B

& ,CD "! H


2O` "

DataTable

V B & + ": 0 +

C !H B T "!B QCD Qa G

!H G ! ? )"

!_

R"

DataTable

M "
+ ""

G` !` ~ " " `

` " " %OH!

r% & ]G

8 9 B "

" " %OH! .%

M B% & ]G

8 9 BL

> !a9 R CIF > ! 2? " A7

?B

\ f+

A_

R; "

2O "
+

" ?B

"

C G C+- V<

!<

"

2O "

C G & ]

public bool MySelect(string sql)


{
con = new OleDbConnection();
con.ConnectionString = strcon; ;
cmd = new OleDbCommand();
cmd.Connection = con;
da = new OleDbDataAdapter(cmd);
dt = new DataTable();
con.Open();
cmd.CommandText = sql;
try
{
da.Fill(dt);
}
catch { MessageBox.Show("Error"); }
if (dt.Rows.Count > 0)
{
return true;
}
else
return false;

)!t` & `] G`
`?

"!`B fO` ! B B

! `B 0 = `* < M ,

`B L

^/
2O "

BG 0 Q_ S "

N 2O` " & K`fO R"!B < CB"


C

! ! R;
fO

2O "
2O "

B ?B
C

?B < ) d

private void button2_Click(object sender, EventArgs e)


{

5 ! >) B
<

R CS

R"!B < QCD


; B"

!<

try
{
if (textBox4.Text != "")
{
if (MessageBox.Show("Are you want to delete", "?",
MessageBoxButtons.YesNo, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2) == DialogResult.Yes)
{
con = new OleDbConnection();
con.ConnectionString = strcon;
cmd = new OleDbCommand();
cmd.Connection = con;
con.Open();
cmd.CommandText = "delete from stud where
studnumber=" + textBox4.Text;
cmd.ExecuteNonQuery();
con.Close();
textBox1.Clear();
textBox2.Clear();
textBox4.Clear();
studAtr_Load(sender, e);
MessageBox.Show("delete");
}
}
else
{
MessageBox.Show(" ]: # 8 c Y
!3 #!* d =");
}
}
catch
{
MessageBox.Show("Error");
}
}

2O` "

C`

N A] QCD B ^0$!%

CB"N

QCD

5 ! >) B
% ! < R a

private void button3_Click(object sender, EventArgs e)


{
try
{
if (textBox4.Text != "")
{
con = new OleDbConnection();
con.ConnectionString = strcon;
cmd = new OleDbCommand();
cmd.Connection = con;
con.Open();
cmd.CommandText = "update stud set name='" +
textBox1.Text + "',family='" + textBox2.Text

+"'"+",term="+numericUpDown1.Value.ToString()+ " where studnumber=" +


textBox4.Text;
cmd.ExecuteNonQuery();
con.Close();
studAtr_Load(sender, e);
MessageBox.Show("set update..");
}
else
{
MessageBox.Show(" 3 2
# 7 # !3 Y
8 c ]: # ");
}
}
catch
{
MessageBox.Show("Error : please set your data");
}
}

r{ !d CB" B
private void button6_Click(object sender, EventArgs e)
{
this.Close();
}

]:

) B G =!F load "

""

!< !H

=!F R ; h 8_

d !H

private void studAtr_Load(object sender, EventArgs e)


{
try
{
database2 dbb2 = new database2();
DataTable DTT2 = dbb2.select("select * from stud");
dataGridView1.DataSource = DTT2;
dataGridView1.Columns["studnumber"].HeaderText = "8 c
#";
dataGridView1.Columns["name"].HeaderText = ")
]: #";
dataGridView1.Columns["family"].HeaderText = ")
P#
6";
dataGridView1.Columns["term"].HeaderText = ")!, 4#
";
radioButton1.Checked = true;
}
catch { }
}

B"

" " j C VB % a9 ! R; & KfO

!H

> )!t >


r

! @ M ,B

CellMouseClick

private void dataGridView1_CellMouseClick(object sender,


DataGridViewCellMouseEventArgs e)
{
try

"

d !H
"

!0

{
textBox4.Text =
dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
textBox1.Text =
dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
textBox2.Text =
dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString();
numericUpDown1.Value =
Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString());
}
catch { };
}

?B

)O

B 2+

?B !

$ % & '%
[

??B I > )
[bQa z t T ?B

! "2

(b3 Qa

0 " 1+

" 2 >0 ?

# "

>! H L H
! M

a? > !

C M ,B bQa z t 1 *

!2?< "

b3Qa
?B M ,B
0 "

> ) F =! 0

2% ! >

9 DAp M M

! %!!

A _ GCU "
="!B " 1+ %

" !2?< "


)"

"

!0

0 2? G

)" = 2

?B M ,B

fO CB" >

1] G " 4b3 Qa

4b3Qa

b3Qa

.b3Qa
CB"
5

q` < `B `?B `wB C`

c !< >

?B M ,B 34 >
!

! %!!

Q FG 0 f M ; B"

!2?< "
!< C 0

!) n ! 0 !2?< 9 ?B M ,B

CB" >

! T)0
"

3b3 Qa
?B M ,B .

+>

?B \ f+

) f

b3

6b3

#b3

/b3

?B M ,B .

+>

?B \ f+ >

1] "

" d ! "

?B QCD W[b Qa z t T)0

(b3
WbQa z t

?B M ,B " d

! =!F >

b3

.4b3
?B !

. b3
F U >! h > )
)" = 2

9
fS" & ,CD

?B

) O =!F > !

>

+- ?B " 1+ !P " > ) B

" b Qa & DAp

R"!B

..b3
" 2 >! H L H

! M

H"

T+

BM

+- G+

"!B -A B

t C)
T C

/b3^ % 6*%6
" 7 > ) R 0 >0

" < >c S ?a9 G 0 o )

0 >!] ?D \ f+ > ! R; 0 T 9
" 1+

9 1+ > ) B > !

7 "

T "
+ " G 0 " 1+

U!D
+ "
T 9

6 % ! * -N
.44(

7 R 0 " B
T)

0
t C) %
" T ?B " 1+

R; { 0 " D

7 0 " 1+

T ?B

y! 9g ]" D 0 >

; 8 9 !0 B "
^

7 > ! T ?B

N T ?B

\ f+

private void button1_Click(object sender, EventArgs e)


{
int[] numbers = new int[7] { 0, 1, 2, 3, 4, 5, 6 };
var numQuery =
from num in numbers
where (num % 2) == 0
select num;
foreach (int num in numQuery)
{
listBox1.Items.Add(num);
}
}

)"

! de " d "

R; : T ?B )"

: 0

R; :

7 "

! *9

:%

+_ ! 0 B "

C) B ?B

R; : T ?B )"

QCD ! *+ M ?
7 > ! ?B
+
%

:% r +a

! *9 R; : "
R; +_

"!B

< ! *9

! *9
0 >

var i = 9;
var j = "str";

T )"

=2

select QCD @AB > )

7 G "r

private void button1_Click(object sender, EventArgs e)


{
User[] users = new User[] {
new User{UserName="Ahmad", Age=20},
new User{UserName="Maryam", Age=17},
new User{UserName="Ali", Age=29},
new User{UserName="Hooman", Age=33},
new User{UserName="Sara", Age=22},};

var mySelect = from user in users where user.Age > 20 && user.Age
< 30 select user.UserName;
foreach (string uname in mySelect)
listBox1.Items.Add(uname);
}
public class User
{

public int Age { get; set; }


public string UserName { get; set; }
}

LINQ to SQL
B %d ; T ) d %C _ G " % sqlserver " " P < 5 9 linq y n 0 !P " a
!`_! 5 ` 9 sql " " `P < !9 = C9 $ !) +-

T 9

linq >c S ?a9 0 " 1+


T )" = 2 R; >

"

" 1+ sql " " P < 5 9 > !

)" ! *9 ! 0 .3b3Qa

! >!) n =!F

?B " 2

=0h & ,CD

P$
"!B

F linq to sql0 r +a
! M

a? = 2 > !

.3b3
linq to sql 0 " 1+

sql " " P <

%B! M " !F & KfO R"!B F U r o )

T +

% F B a? > ! T ?B " 2 sql "

" T + ` !` ~
Create
`

? H>

z !p 0

?B " 2

! "

"" P <

" d

?B

! Server Explorer !2?< 0

R; ` " " " " P <

>

!H

?B \ f+

" d

a? > !
! =

a? = 2 0 Q _
! sql " " P <

?B " 2 sql server


?B M ,B New SQL....

?B \ f+ " d V + " > ! = M

?B ! de MyAtr =

?B G 9 ^ fS"N! 0 > ) , F

?B fO

` 0

)!t`

R `$ T `?B \ `f+
` !K` ?

H"

` T `+ ` ,B 0 " 1+`

9 ?B \ +

>!

,B R ?D

d=

!+I

R"!B < Q7 T

> !a9

N % R; R" "!F

d = T ?B

H"
u!F

,B M

! ! de 0 Q _

!K ?

+ " p,B % ] d
% "!F

?B F U

MyLinq =

linq to sql M Add new item %C _ 0

r )" !_ MyLinq.dbml =!F >

"

Oa

?B M ,B

"" j C

1] >

a? = 2

>) ,F

"

C !

! !H

` : !` `9 ?B M ,B R"!B F U CB" >


" `2

MyLinqDataContext@A`B

" " Connection string M

! T
M

\ f+
?

+-

0 "
T 9

0 @AB G T ) = 2
r

r ?B )"

% "

H"

,B

+ " R ? Cp r +a

> ) B 9 ,] =!F

%C _ G " T ?a R C ) B G+
H"

R"!B F U & ,CD T ?B

V + " properties 0

R; > ) , F

"!H!

?B " 2 R CS

R;

= 0 @AB M

string str = "Data Source=(local);Initial Catalog=test;User


ID=sa;Password=666666;Pooling=False";
private void button1_Click(object sender, EventArgs e)
{
MyLinqDataContext _MS = new MyLinqDataContext(str);
MyAtr _MYdata = new MyAtr();
_MYdata.name = textBox1.Text;
_MYdata.family = textBox2.Text;
_MYdata.Tel = int.Parse(textBox3.Text);
_MYdata.Address = textBox4.Text;
_MS.MyAtrs.InsertOnSubmit(_MYdata);
_MS.SubmitChanges();
MessageBox.Show("insert");
}

`+

` 9 ` T `?B `

`)"
T ?B

`
! de

MyAtr

@A`B > ) `, F `B %` & `] G`

& DAp G

DataContext

@AB 0

BL

SubmitChanges();

j C

& DAp 9 ?B M ,B

show Table data

"!B %

M ,B

= >

!
"

r H"

d= @

! R"!B <

""

5 ! >) B

private void button2_Click(object sender, EventArgs e)


{
MyLinqDataContext _MS = new MyLinqDataContext(str);
var deleteOrderDetails =
from details in _MS.MyAtrs
where details.family==textBox2.Text
select details;

foreach (var detail in deleteOrderDetails)


{
_MS.MyAtrs.DeleteOnSubmit(detail);
}
_MS.SubmitChanges();
MessageBox.Show("Delete");
}

CB"

5 ! >) B

private void button3_Click(object sender, EventArgs e)


{
MyLinqDataContext _MS = new MyLinqDataContext(str);
var tb = _MS.MyAtrs.Where(p => p.family.Equals(textBox2.Text));
foreach (var roe in tb)
{
roe.name = textBox1.Text;
roe.Tel = int.Parse(textBox3.Text);
roe.Address = textBox4.Text;
}
_MS.SubmitChanges();
MessageBox.Show("Update");
}

` > )!t` >

MyAtrs

T ?B

A]

!`

select Q`CD linq &

!t R; & KfO

\ f+ B >!t

r! 0 B Q7

"

+ " 0 " 1+
T )"

?B QCD VaD!

+ h >) B "

=2
B Q7

, F R" ! ! 5!
9

2+

>!

private void button4_Click(object sender, EventArgs e)


{
MyLinqDataContext _MS = new MyLinqDataContext(str);
var tb = _MS.MyAtrs.Where(p => p.family.Equals(textBox5.Text));
foreach (var roe in tb)
{
textBox1.Text = roe.name;
textBox2.Text = roe.family;
textBox3.Text = roe.Tel.ToString();
textBox4.Text = roe.Address;
}
_MS.SubmitChanges();
}

B G =!F load "

"

!H + "

R"!B !< > !

private void Form1_Load(object sender, EventArgs e)


{
MyLinqDataContext _MS = new MyLinqDataContext(str);
var DATA = from p in _MS.MyAtrs select p;
dataGridView1.DataSource = DATA;
}

& ]

DATA

"

\ f+

> )!t

MyAtrs

C9 linq & + " 0 " 1+

"! H

!_

B "

S e
M

a? > ! %
"

%F "

R; =

7
F

T + !1 )!2

F =! Qd "

R; Qd "
!<

7 R 0& + "

R C9 + "

T 9

% R; > ! %D!

0 "

T ?B
> )!+

+ ) !2

"2

< G ?lC)

! % ? G+F h )!2

!< " 2 0 o )
:

T ?B
!< >

Qd " !2

!<

d !F
,C 0 T ?B

"" P < " )

$PROCEDURE)

!2

!< 0 " 1+

" !F >"!F & KfO B

? >

! r

?B ! de 7
?B " 2

fS"

R;

>) ,F

?B " 2

fS" =

V +"M

=" " g U 9 , _

M ,B 1

!*

>

a? > !

) !2

r! 0 Qa z t

!< " 2

7 "

!2

?B " 2 !2

!< R "

a? = 2 > !
Q- ! G " 2

?B " 2

"2 0
!< M

"!B %

CREATE PROCEDURE dbo.StoredProcedure1


/*
(
@parameter1 int = 5,
@parameter2 datatype OUTPUT
)
*/
AS
/* SET NOCOUNT ON */
RETURN

+ " Q7
ALTER PROCEDURE dbo.StoredProcedure3
@Mname nvarchar(50),
@Mfamily nvarchar(50),
@Tel int

=0h & + "

AS
insert into Table1 values(@Mname,@Mfamily,@Tel)
RETURN

@Mname!+

!C)

!2

< Q7 "! H

!< = %

!_ )!+

=0h

< R " T + !F

0 B >! "
"

"

FU

r! 0 B Q7 T

B "
)!+

<

> )!+

<

private void button1_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand();
con.ConnectionString = "Data Source=(local);Initial
Catalog=TestMN;User ID=sa;Password=666666;Pooling=False";
con.Open();
cmd.Connection = con;
cmd.CommandText = "StoredProcedure3";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Mname", SqlDbType.NVarChar).Value =
textBox1.Text;
cmd.Parameters.Add("@Mfamily", SqlDbType.NVarChar).Value =
textBox2.Text;
cmd.Parameters.Add("@Tel", SqlDbType.Int).Value =
int.Parse(textBox3.Text);
cmd.ExecuteNonQuery();
con.Close();
}

T
0
T

"

? T 9

!2

!< =

> ) !+

<

F
T )"

! 0 B Qa

G+

>

CommandType.StoredProcedure

!!

CommandText

!_
h

" 7 & + " T +

+ " "

T ?B

FU

CommandType

Parameters.Add0

r ) !2

!< 0 " 1+ R

private void button1_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand();
con.ConnectionString = "Data Source=(local);Initial
Catalog=TestMN;User ID=sa;Password=666666;Pooling=False";
con.Open();
cmd.Connection = con;
cmd.CommandText = "insert into Table1
values(@Mname,@Mfamily,@Tel)";

B "

" 1+
?

cmd.Parameters.Add("@Mname", SqlDbType.NVarChar).Value =
textBox1.Text;
cmd.Parameters.Add("@Mfamily", SqlDbType.NVarChar).Value =
textBox2.Text;
cmd.Parameters.Add("@Tel", SqlDbType.Int).Value =
int.Parse(textBox3.Text);
cmd.ExecuteNonQuery();
con.Close();
}

r )" = 2

>!

QCD B T ?B " 2 !P " !2

!< M

!H

R"!B !< > !

ALTER PROCEDURE dbo.StoredProcedure1


AS
select * from Table1
RETURN

rT

"

!0 B

private void button2_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand();
DataTable _DA = new DataTable();
con.ConnectionString = "Data Source=(local);Initial
Catalog=TestMN;User ID=sa;Password=666666;Pooling=False";
con.Open();
cmd.Connection = con;
cmd.CommandText = "StoredProcedure1";
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter _SDA = new SqlDataAdapter(cmd);
_SDA.Fill(_DA);
cmd.ExecuteNonQuery();
dataGridView1.DataSource = _DA;
con.Close();
}

+ !0 B " T

%OH!

T f )!2

"

!_! 5! R; !H

)"

= 2 R; >

!< 0 " 1+
!

R CS

p! !2

!<

T + !F
r "!H

ALTER PROCEDURE dbo.StoredProcedure2


@Mname nvarchar(50) output,
@Mfamily nvarchar(50) output,
@Tel int output,
@Search nvarchar(50)
AS

>! "

T) d
!2

>!

!<
>! "

SELECT
@Mname=Mname,
@Mfamily=Mfamily,
@Tel=Tel
from
[Table1]
where(Mname=@Search);
RETURN

private void button3_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand();
SqlDataAdapter dataadap = new SqlDataAdapter();
DataTable tabla = new DataTable();
con.ConnectionString = "Data Source=(local);Initial
Catalog=TestMN;User ID=sa;Password=666666;Pooling=False";
con.Open();
cmd.CommandText = "StoredProcedure2";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
cmd.Parameters.Add("@Mname", SqlDbType.NVarChar, 50).Direction =
ParameterDirection.Output;
cmd.Parameters.Add("@Mfamily", SqlDbType.NVarChar, 50).Direction
= ParameterDirection.Output;
cmd.Parameters.Add("@Tel", SqlDbType.Int).Direction =
ParameterDirection.Output;
cmd.Parameters.Add("@Search", SqlDbType.NVarChar, 50).Value =
textBox4.Text;
cmd.ExecuteNonQuery();
con.Close();
textBox1.Text = cmd.Parameters["@Mname"].Value.ToString();
textBox2.Text = cmd.Parameters["@Mfamily"].Value.ToString();
textBox3.Text = cmd.Parameters["@Tel"].Value.ToString();
}

S G !E J

ASP.NET

0 " 1+
"

%
U 9

M T 9

P$ a? T ?B v

+ T 0 "!w v

a? 0 Q _

% !+? & 1]
S T ?B

" T) d

- !p

+ !+?
I+

G %d

G %d

T )" q < &h

">
5 !

!d = % J Q7

> ) & 19 S T
hM

"!B

Q7

T) d

> IS

QKF G "

I ; >!) n Qa

Q aO9 h G ?$ 0 & 1] %d "!< T ) d I ;


h G " !+O

h - 9 C+-

C >!

? ; I ; Q _ > I,KF " B %

,C 0 y,+f > ) R 0

: U G R !<

! R + ) B = 2 > ! % !+?

;j<>

"

" asp >c S ?a9


T )"

< %d "!<

jf G

!P " > ) $

+-

I; j C

I !F %d
B" d

& 1]
TO$

B & 1] - !p h

2?
"

!H R $ %
k, " d

" d!

T 9

h G

- !p T "

hG

"

9 DAp

R; " B" " "

>!P "

a? R

R"!B 0 > ! T + !F
!_

+d "

0 "

! 0 ?

& 1]

P$ ) B G T

a? = 2 > ! T

B&

"

,B

d " M 8_

)"

q <

a?

T
> B

& 1]

?B

Q] A7 N % %f

+ !+? & 1] "!a,CD

! G T+

9 1]

R C ) B !P " > ) R 0

+_ % !+? & 1] " S "

> ? + x d Qa9 !< 0 " 1+


=2

N G !9 0

G ! ? ^ " " > I) P <

! " " " !F windows application

Q7 @ "; M R !9 w B "
%

Html,ajax,asp

>!+O %D! > " B T ?B - !p > p

T
% 9>)

B !

>" 0 R ! B % GaC T ?B - !p Qa ^ G O?S" R ;

! > ) B G+
R 0

] d % C) 0

>

+_ 0 ?

" !9 w B G ?$ G
"T
!

d"

d " T )"

S VaD! "

T 0 "!<

q < "
d"

" + !F ! "

%d

r ?B " 2

"

www.yahoo.com

>0

F \ +B G
fS" =

+_

)"
%

" "! H

\ c !< M

rT

! 0 B Q7

) m9 G > ) B C) \ & 1] %d
"

- !p

"

> ) R 0 !P " html R 0 "

m9 " G > ) B

fO m9 =

+ B

<body>
/////////////////////code
</body>

r Q7

?B

)O

<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>

) B "!B " 2 >

c !< C

+_

) O >! "

I+

+ m9 " G > ) B C)

"!B -A

?B M ,B Design>

% div

Oa

R C) B ?B

CB" a? = 2 > !

)O

Sd

F %

t C)

S d - !p

- !p

1] + "

)" !_ CB" M div m9 " G source %C _ "


r! 0 Qa Q7

^ )" !_

> "N r ?B

)O

CB" Qa

)" !_ div S d > sF

"!H! Design

r ! 0 B Q7

?B

)O

2+

)" ! *9

R; text

"!H!

<div>
<asp:Button ID="Button1" runat="server" Text="Test" />
</div>

- )" ! *9

! Qa

B
r ?B

Q7

) B G ! ? ??B

" 1+ asp >c S ?a9 0

" ! *9
)O

"

" " j C ) 0 ! !P " Internet Explorer


"

! %C

" !+?B

5 ! >) BT) d

2+
+

"

"!B

t C)

?B ! ctrl+F5

asp:
+

)O B

) B r +a

html R 0

div

9 \ & 1] > ) B r +a

runat="server

R" " !_ r +a

T "" = 2

- !p

F T + ? R; > ! > B 0 ?) R $ +F

_ 19 ) ?B M ,B CB" >

T ?B " 1+
r )" !_ ! 0 Qa

0
B0

! !H

B G+

>!

VB % a9 M r

<div>
<asp:Button ID="Button1" runat="server" Text="Test" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>

r! 0 B Q7

?B " 1+ Br0 "! H !_ G < !t

" VB % a9 B +

d !H

<div>
<asp:Button ID="Button1" runat="server" Text="Test" />
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>

R; M ,B "

>!

fO G+

!0 B "

VB % a9 Qd " G+ B T ?B

"

9 ?B S + M ,B

d"

! 0

" CB" >

8_

" BG

?
?B !<

protected void Button1_Click(object sender, EventArgs e)


{
TextBox1.Text = "computer";
}

!F

r ?B " 1+ ! 0 B Q7
<asp:Button

BackColor

?B u D

)O

2+

?B !

CB" ? CU %O< m

d !H

ID="Button1"
runat="server"
Text="Test"
onclick="Button1_Click" BackColor="Blue" />

r +a
Qa M

+_

1]! 0 " ^>!P " QCD !) N 0

B % ? R; Q S"

Test CB"

?B

" O !< k 9!9

! C

BR < 9

+_

" A7

)"

=2

q < C %
QCD G

R $ + S N ?B
= 2 %D!

d"

+ !F

?B !< !9 w B =

)O

d "G

T!

d " 8_

"

VB % a9 B "!B %

>

B G " " !_

1] " C

" d "

+ !F

OF
d" C

C >!

! R + >!

CB"
! G
2+

>0 2

)"
2? "
^ "! H

T)

?B " 1+ label 0

T) ?B F U

U 9

r ?B i 9

d !H

" d G+ T +

T "!H !

& ]

a?

<div>
<asp:Button ID="Button1" runat="server" Text="Test"
onclick="Button1_Click" BackColor="Blue" />
<br />
!, 'e *
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>

GaC

)" ! *9
?B " 1+

R; > ) H
style

!H G ! ? +F!H !_ div m9 R " )


9

) H

! *9 > ! "! H &

] )

C) R $

QB " 9 ! *9

<div style="font-family:Tahoma;background-color:Green">
<asp:Button ID="Button1" runat="server" Text="%'H* ' *"
onclick="Button1_Click" />
<br />
!, 'e *
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>

)" ! *9

R;

text-align

%]d

! H !_

1]

" )

C)

d !H A7
center

<div style="font-family:Tahoma;background-color:Green;text-align:center">
<asp:Button ID="Button1" runat="server" Text="%'H* ' *"
onclick="Button1_Click" />
<br />
!, 'e *
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>

r ?B QCD Qa G
?B wB

< G R " VaD M

"!B %

M ,B

?B " 2

1] >
fS" =

! VaD R" " !_ > !


newfolder M

+
r

)" !_ B %C _ " Image M


<asp:Image ID="Image1" runat="server" />

?B QCD ! 0 Qa Q7 % F B a? > !

)" !_ VaD ! !

ImageUrl

r ?B i 9 T +

R;

!H

)O

VaD ?B !

! !H

VaD +

d !H r +a

<asp:Image ID="Image1" runat="server"

ImageUrl="~/NewFolder1/Penguins.jpg" />

"!B ) d
%

M$ B

64 ? T )

?B

!_ ] " 64 ! !

a
Width

1] 0
!H A7 T ?B

+C _ !P " !+?B !)

" 1+ % % AD 0 ?B ! *9
?a

1] 0
1] ] "

<asp:Image Width="50%" ID="Image1" runat="server"


ImageUrl="~/NewFolder1/Penguins.jpg" />

"2 \

! M

a? > ! T

? ; html > ) !+?B 0 "

?$

)v

" 0 Q_
?B

r 7 "

" 1+

!+?B G 0

d " 2 > ! r <hr

/>

<div >
<hr />
</div>

G < !t
r 7

" # 9

+ >! r

<br />

: ! M 0 B & 1+ % fU G+ j C > ! r

<h1>

<div >
<hr />
<h1>Computer</h1>
<h2>Computer</h2>
<h3>Computer</h3>
<h4>Computer</h4>
<h5>Computer</h5>
<h6>Computer</h6>
</div>

G+ R"!B m !< > ! r <B>


<B>This text displays boldface.</B>
<I>This text is italic.</I>

r 7 G+ > H
<ol>
<li>computer</li>
<li>book</li>
<li>door</li>

C > ! r <ol>

</ol>

G+ 0
<P>This

paragraph

contains

single

<SPAN

STYLE="color:

+C _ m ! *9 > !
blue">blue</SPAN>
word

Table :

!+?B !) R" " !_


" d>
r

B& ]G

" ] d T
?

) R + ! Qa

!+?B!)

m9

] d T

) d >! H , T)

B %C _ "

?B " 2

) !+?B Qd 9 0
c !< M

0 " 1+
>

d !) "

a? = 2 > ! % O ) d

<div>

<table>
</table>
</div>
</form>

M !t M

M !0 B "
r"

" " j C m !< 9 T )"

<table border="2">

<tr>
<td>
</td>
</tr>
</table>

7 > ! T ?B

y! 9
!_ . ! !

)R +

) !t

>!

border T "!B " 2 R +

</div>

T ?B

FU

R +

!0 B "

7 > ! "! H

!_ !t m9 Qd "

> ) R + r +a
r

<table border="2">
<tr>

<td></td>
<td></td>
<td></td>
</tr>
</table>

r% R +

> " B T ?B

FU

!P " !t M

<table border="2">
<tr>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>

rT )"

!_ 44 ! !

R;

width

"! H ! "

1] u!D QB

a? > !

<table border="2" width="100%">

"

< =

) Q S % a9

)" !_ = "
r ?B F U "

>)R + >
Va9 =

! Q S " VB % a9 "
R + >

! CB" M

)" ! *9

>
Qa

] d T

) !+?B

"

I ; width % !+I

) d B

t C)

" dxd 0

?B

)O

2+

?B !

> " R + !) a? > !

1]

r )" ! *9 ! 0
<table border="2" width="100%">
<tr>
<td style="width:20%" >
<asp:Label ID="Label1" runat="server" Text="UserNmae"></asp:Label>
</td>
<td style="width:50%">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
<td style="width:30%">4 !3 #
%'H* ' *</td>
</tr>
<tr>
<td style="width:30%" >
<asp:Label ID="Label2" runat="server" Text="Password"></asp:Label>
</td>
<td style="width:50%">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
<td style="width:30%">
<asp:Button ID="Button1" runat="server" Text="#
" />
</td>
</tr>
</table>

r ?B o-

)" C = 2

,CD ) B "!B

border="2"

) d

)O

" O "" j C

?B M ,B "
%

CB" >
O +

> ) S +

?B !

d !H

R; > ! > B ) R $

S Validation
CB" +_ & ] G ! ~ " ?B "
L

?B QCD L

" + !F

%_ T)

"G

9
p!

" + !F

>! B =

C+- ! B

" "! P = 2

+_ R $ %

d B A] G

q <

?B

!+?B

?B "

" d

dh
0

7 " !H
! B

5! G

) VB % a9
! 0 Qa

? T ?B

" Validation0

?B !< " d

T)

"

>" f

RequiredFieldValidator

+ 1tS A7

"

B % ) 5! 0 " 1+

> $ T ) f a? 0 Q _ G ! ? T ! H

)" !_ VB % a9 " ?B "

M TextBox1

,CD )

G !+O " > ! T ?B " 1+ ^ U + b! BN Client %C

ErrorMessage

"

<

& ]G

>!+O R 0 T) B )"

BG "

7 "L

"

5! G
) d

T ?B !+?B

" d"

\ K+

fS" +

) G

!+?B " h
!+?B

kK+? "TextBox2

<table border= width="100%" >


<tr>
<td style="width:20%" >
<asp:Label ID="Label1" runat="server" Text="UserNmae"></asp:Label>
</td>
<td style="width:50%">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server"
ControlToValidate="TextBox1" ErrorMessage="
"></asp:RequiredFieldValidator>
</td>
<td style="width:30%">4 !3 #
%'H* ' *</td>
</tr>
<tr>
<td style="width:30%" >
<asp:Label ID="Label2" runat="server" Text="Password"></asp:Label>
</td>
<td style="width:50%">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
runat="server"
ControlToValidate="TextBox2" ErrorMessage="
"></asp:RequiredFieldValidator>
</td>
<td style="width:30%">
<asp:Button ID="Button1" runat="server" Text="#
</td>
</tr>

" />

</table>

"

) VB % a9 "

> +

T)

?B M ,B "

CB" >

?B !
?B

)O

!
2+

?B

3// 0 !+H

"

" D A7

?B M$

>!P " 5! R"


r 7 "

Sd !

AD

d !H

" 1+ RangeValidator !+?B

<asp:RangeValidator ID="RangeValidator1" runat="server"


ControlToValidate="TextBox1" ErrorMessage=" f6"
MaximumValue="1377"
MinimumValue="1357"> f6
</asp:RangeValidator>

r & 1] R"!B F U
Web Form M Add new Item %C _ 0 % F B

!P " & 1] R"!B F U > !


?B F U R + !

)" !_ VB % a9 M

fS" =

1] >

<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>

? R; > !

!0 B

?B M ,B

""

CB" >

1] "

protected void Button1_Click(object sender, EventArgs e)


{
Response.Redirect("Default2.aspx");
}

"%

!_ B

)" !_ >

set as start

1] G S R ?D
?B %

M ,B

1]
1] >

?B !
! % FB

! a? 0 Q _
a? > ! "
?B \ f+

% ) BG

?B M ,B "

CB" >

?B !<

VB % a9 ! "

?B !

R; page

% !P " & 1]
1]

!0 B

7 >!

?B " 1+

html> ) B 0 !P " & 1]


r"

<div>
<a href="Default2.aspx">GO TO PAGE</a>
</div>

% )

% ) >!
fO

?B

)"

R; S!+?B "

?B

"
! %C

"

Session

> I B % a9

R $"

T) d

!0 B"

" 1+

y! 9 ,

G 0 L
Session

! *+ M C

%OH!

+_ r +a

! 0

+_ !P " + !F

0 & 1] G & DAp

+ > ! r +a

7 " A7

"

C < %OH! 8_

& DAp "

CB" "

" a? > ! T )" j C = "

! de

1] "

1]

protected void Button1_Click(object sender, EventArgs e)


{
Session.Add("mas", TextBox2.Text + TextBox1.Text);
Response.Redirect("Default2.aspx");
}

!"

= R;

?B !Be R; > ! = M

+ !1

Session

)" !_ > CB" = "

>
1] " -

) f

+_

+ " Session

<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="ts" />
</div>
</form>
</body>

r ?B

)O

Session

? R; > !

!0 B

protected void Button1_Click(object sender, EventArgs e)


{
TextBox1.Text = Session["mas"].ToString();
}

1] CB" > ! ! 0 B Q7

+ !1 >! "

= "

1]

d !F = P?)

protected void Button1_Click(object sender, EventArgs e)

d !H

{
Session.Add("mas", TextBox2.Text + TextBox1.Text);
Response.Redirect("Default2.aspx?num1=" + TextBox1.Text + "&num2=" +
TextBox2.Text);
}

>!r

= "

1] B

- "! P

!_ num2 "

" num "TextBox1


)" !_ = "

1] >

& ]G "
! Q S "R +

protected void Button1_Click(object sender, EventArgs e)


{
TextBox1.Text = Session["mas"].ToString();
Label1.Text = Request.QueryString["num1"];
Label2.Text = Request["num2"];
}

?B

)O

?B o)" !_

1] >

! CheckBoxList M

2+

QueryString

CB" M

?B !

!
9

?B " 2

r +a
c !< M

<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" />
<br />
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
</asp:CheckBoxList>
</div>
</form>
</body>

>) B"
"

9M

!0 B

%
?B

CheckBoxList1

d !F

CB" M ,B "

fS" "

CheckBox

a? = 2 > !

R"!B F U

! G 0 o )

T) d I;

" " B !P "


r

protected void Button2_Click(object sender, EventArgs e)


{

? R;

ListItem g;
for (int i = 100; i <= 150; i++)
{
g = new ListItem();
g.Text = "8 c " + i;
g.Value = i.ToString();
CheckBoxList1.Items.Add(g);
}
}

"

?B " 2

R $N T ?B F U
?B !

@AB 0

ListItem

CheckBoxList1

-^T

M % FB

> IC+ ;

+ "

T ?B )"

!+ " T 9

R"!B F U > !

CheckBoxList1

R;

Value Text

CheckBoxList1!]

?D

value 0 " 1+
r ?B

fS" "

RepeatColumns

"" j C R +

"

"" j C R +

" ) CheckBox QB )" !_

!!

?$ " )

^CheckBox

)O

2+

d !H

CheckBox

RepeatColumns

!H A7

?B T ?9
"

<asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatColumns="3">


</asp:CheckBoxList>

B
r

) VB M$ ! B T ) d
?

! 0 B = " CB" > ! "

?B F U

!P " CB" M RadioButtonList M

" " j C RadioButtonList M " ^ "0 M 9N "!B \ f+

protected void Button2_Click(object sender, EventArgs e)


{
for (int i = 0; i <= 50; i++)
{
ListItem g;
if (CheckBoxList1.Items[i].Selected)
{
g = new ListItem();
g.Text = "8 c " + CheckBoxList1.Items[i].Text;
g.Value = (i).ToString();

RadioButtonList1.Items.Add(g);
}
}
}

r ?B M ,B = " CB" >

=2

BG
r

; a? !

? "

? source %C _ "

?B \ f+ VB M$ ?$

"" j C C

*<

! 0 B a? = 2 > !

CB" >
?B " 1+

?B !

! M ,B

) i !a

) f !H
0

"! H

<head runat="server">
<title>Untitled Page</title>
<script type="text/jscript" language="javascript">
function aa()
{
if(!confirm(' 7 'H
\ +g
c
Z # '))
{
return false;
}
}
</script>
</head>

?B !

)" !_ i !a

8 9=

!!

OnClientClick

CB" "

<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click"


OnClientClick=" return aa()" />
<br />

"N"

ok CB" >
+

"

OnClientClick

"

! ! B !H "
" " %OH! false

"
' T )"

+ a 0 A_ B % & ] G

d !F i !a
!H

^"
0 T)0

onclick

"" j C

OnClientClick

)"

C " + !F

%OH! true

! %C

* < " I ; % a9

1+ i !a

RadioButton

"

T ?B

% a9

" ^ client %C
M aa 8 9 "!B M ,B

& DAp

RadioButton!)

BL

? N"
>

! M ,B

P$ S

y! 9

C !

onclick

d !H

?B " 1+ i !a

CD ! *+ M

a? > !

RadioButtonList1_SelectedIndexChanged

rT ?B

d !FRadioButtonList1 >

! M ,B

"

public string str;


protected void RadioButtonList1_SelectedIndexChanged(object sender,
EventArgs e)
{
}

%C _ "

" " !_ str "

R;

"

" m? !+ kS _ "
rT ?B

i !a

" 1+ R; 0 source

public string str;


protected void RadioButtonList1_SelectedIndexChanged(object sender,
EventArgs e)
{
str = "<script language=javascript>alert('" +
RadioButtonList1.SelectedItem.Text + "')</script>";
}

T ?B QCD Qa G

% F B source %C _ " m? !+ G R" " !_ > !

</div>

<%=str %>
</form>

)" ! *9 true
r"

CheckBoxList RadioButtonList1 AutoPostBack

! %C

" I;

5 ! > ) B I; >

! M ,B

!)

! >! 0 Q _

9"

vD

BG

<asp:RadioButtonList ID="RadioButtonList1" runat="server"


onselectedindexchanged="RadioButtonList1_SelectedIndexChanged"

AutoPostBack="True">
</asp:RadioButtonList>

r ?B

)O

2+

?B !

S MasterPage
!H A7

?B " 1+

%
0

"2 \

"

MasterPage 0

%C

% J %C _ M > " & 1] C)

" ? M

1] !) "
! M !+O

1] >h

?a " 1+

?B F U

" VaD M > " & 1] C)

) MasterPage 0 !H

? ; >!

) = 2 =!F !) > !
!

?B " 1+

d !H
+

) MasterPage

% J > ) %C _ - !p Q- !

MasterPage M Add New Item 0

?B

" & 1] C) ) %

R;

& 1]

+C _ MasterPage " %
" B +C _ ? "

?B - !p

H !) MasterPage

- !p MasterPage " B

" 1+
"! H

I !F

- !p > ! B

!_ R; "

"

1] " !H

B !+

1] 0

ContentPlaceHolder

1] !) > ) !+?B

?+

+C _

"

!+O y,+f & 1]

<%@ Master Language="C#" AutoEventWireup="true"


CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:ContentPlaceHolder id="ContentPlaceHolder1"
runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>

!_

ContentPlaceHolder

"

%C _ M "

?B " 2 MasterPage " S

" " x K+d ) !+?B R" " !_ > ! I !F :


T ?B

" 2 ..

!H G ! ?
%C _ R; T )"

! %C _ G C) " 7 > !

<form id="form1" runat="server">


<div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
<table border="1" width="100%">
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</div>
</form>

0 T ?B o- tr "

)td0

T ?B QK+ T)

h R +

" a? > ! r +a

r ?B " 1+

colspan="2"

<table border="1" width="100%">


<tr>
<td colspan="2"></td>
</tr>
<tr>
<td ></td>
<td></td>
</tr>
</table>

0 "

> ) !+?B

1] !) 9

)" !_

R +

= " !t Qd "

ContentPlaceHolder

)" !_ %C _ G "
<table border="1" width="100%">
<tr>
<td colspan="2"></td>
</tr>
<tr>

" d

<td ><asp:ContentPlaceHolder id="ContentPlaceHolder1"


runat="server">
</asp:ContentPlaceHolder>
</td>
<td></td>
</tr>
</table>

> ) %C _ "

VaD R" " !_ L

"! H !_

1] !) " 9 T )"

!_ VaD M

!t

T"" g U 9 , _
<table border="1" width="100%">
<tr>
<td colspan="2">

<asp:Image ID="Image1" runat="server"


ImageUrl="~/NewFolder1/Persia 176.jpg" />
</td>
</tr>
<tr>
<td ><asp:ContentPlaceHolder id="ContentPlaceHolder1"
runat="server">
</asp:ContentPlaceHolder>
</td>
<td></td>
</tr>
</table>

T
? H

1] G

1] M R"!B F U 8_

!P " T " " = 2

master page

% F B master page
T

1] - !p a? 0

R C9 1] R"!B QK+ > !

M 9 select master page

?B F U

!) !+?B

?B

N )" !_

"

1] "

> ) !+?B

1] !)

?B o-

,_

1] R + > !

ContentPlaceHolder

^& 1] & 19 R CIF > !


!_

1] CB" > !

!0 B

)" !_ VB % a9 M = "

1] "

%C _ "

& 1+

CB" M

1]
1] "

protected void Button1_Click(object sender, EventArgs e)


{
Response.Redirect("Default2.aspx");
}

)O

2+

?B !

?B \ f+ Set As start page R ?D

1]
?B

r )" ! *9

center

0 %C _ R;

1]

text-align

" VaD R" " !_ > !

<tr>
colspan="2" style="text-align:center">
<asp:Image ID="Image1" runat="server"
ImageUrl="~/NewFolder1/Persia 176.jpg" />
<td

</td>

y,+f > ) jf

% ) ) ? G 0 o ) T 0 "!<

Navigation " T ?B
& ]G

" 1+

= "R +

) Navigation 0

B L TreeView Menu Q7 T ?B
T ?B

" 1+
FU

= " !t > ?
a? > ! %

- !p

R C+ ^& 1]N

I; 0 B " " "


sitemap M

!+?B G ?$
+ " B%

<?xml version="1.0" encoding="utf-8" ?>


<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="" description="">
<siteMapNode url="" title="" description="" />
<siteMapNode url="" title="" description="" />
</siteMapNode>
</siteMap>

"

url

"

"
B

" 1+
1]

= %J

R ?D

!P " & 1]

1] A7 T )"

& 1]

,]
" 9

1] =
U 9

title

<?xml version="1.0" encoding="utf-8" ?>


<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Default.aspx" title=" h " H" " description="">
<siteMapNode url="Default2.aspx" title=")
ij " description="" />
<siteMapNode url="Default3.aspx" title="
*" description="" />
</siteMapNode>
</siteMap>

SiteMapDataSource M

T)

!_

fO

d " %d " M
rT )"

r "!B 0

!_ R C !

web.config

? M
1] "

1]

<system.web> </system.web>

!0 B

<siteMap>
<providers>
<add name="MYU" type="System.Web.XmlSiteMapProvider"
siteMapFile="Web.sitemap"></add>
</providers>
</siteMap>
</system.web>

M
r T ?B

B " " 0

B G

FU

SiteMapDataSource

SiteMapProvider

>!

%C _ "

SiteMapDataSource

! 0 B G ! ? T "!B F U B % " 0

Web.sitemap

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"


SiteMapProvider="MYU" />

T )"

!_

SiteMapDataSource1

!!

%d "

? > ) !+?B

DataSourceID

rT ?B

<asp:Menu ID="Menu1" runat="server"

DataSourceID="SiteMapDataSource1">
</asp:Menu>
<br />
<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="SiteMapDataSource1" >
</asp:TreeView>

Qa

R; Auto Format

?B M ,B % AD >

%d "

?
r ?B T ?9

0 >!
fS"

r ?B

r ?B " 1+ R;0

>!

?B F!
rT )"

1] >

! R; R" " !_

Web.sitemap "
! *9 ! 0 Qa

+-

R; % F B
B T ?B

)O

"!B F U

FU

2+

?B !

SiteMapPath !+?B 0

>

1] !)

computer =

G 0
1] M

?xml version="1.0" encoding="utf-8" ?>


<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >

<siteMapNode url="Default.aspx" title=" h " H" " description="">


<siteMapNode url="Default2.aspx" title=" j )
" description="" />
<siteMapNode url="Default3.aspx" title="
*" description="" />

<siteMapNode url="computer.aspx" title="


description="" />

"

</siteMapNode>
</siteMap>

!P "

<siteMapNode></siteMapNode>

?B

M % !+I

9 +a G

)" !_ !P " d

"

)" !_ R; Qd " ! "

& 1] +
& 1]

d !H

?B y ! 9

"! H !_ , _ d

Qd "

<?xml version="1.0" encoding="utf-8" ?>


<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Default.aspx" title=" h " H" " description="">
<siteMapNode url="Default2.aspx" title=" j )
" description="" />
*" description="" />
<siteMapNode url="Default3.aspx" title="
<siteMapNode url="computer.aspx" title="!, 'e *" description="" />

<siteMapNode

url="a.aspx" title="
<siteMapNode url="b.aspx" title="

" description="">
" description="" />

</siteMapNode>
</siteMapNode>
</siteMap>

S FileUpload
" 1+
!_

FileUpload0

1] >

?B ! de

! FileUpload !+?B 0

"

?B " 2 \

?B %F "
! M

, F ! B o!p 0
!+?B G

? ; >!

d !H
?B
r )"

<div>

<asp:FileUpload ID="FileUpload1" runat="server" />


</div>

soluotion %C _ "

fS" =

<M

)" !_

1] >

VB % S M

^ I, F ! de > ! N

CB" M

?B " 2 Explorer

<div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<asp:Button ID="Button1" runat="server" Text="Save" />
<br />
<asp:ListBox ID="ListBox1" runat="server"></asp:ListBox>
</div>

! B

\ f+ Q F & KfO

T ?B ! de

< " ^VaD Q7 N

s
Q F

T) d
^% !F Q F 0

? ! de CB" > !

!0 B

Q7 N T )" j C VB % S "

protected void Button1_Click(object sender, EventArgs e)


{
ListBox1.Items.Add(FileUpload1.PostedFile.ContentLength.ToString());
ListBox1.Items.Add(FileUpload1.PostedFile.ContentType);
ListBox1.Items.Add(FileUpload1.PostedFile.FileName);
ListBox1.Items.Add(FileUpload1.HasFile.ToString());
ListBox1.Items.Add(Request.PhysicalApplicationPath.ToString());
string str = Request.PhysicalApplicationPath + "MyFile\\" +
FileUpload1.FileName;
ListBox1.Items.Add(str);
FileUpload1.SaveAs(str);

! B0

! "

> I, F

" VaD C Q F !H
!_

1] >

!~

d !H B % ? Q F & KfO R" ; % "

! asp : 0 image

,B

0 !+a$ B I, F 0

html : 0

img

A7

0 o )

?B "

!+?B M % !+I

) f

) j C

r^ ?B F U N )" ! *9 ! 0

+
B

d
)"

<br />
<img alt="" id="mas" runat="server" src="" />

mas.Src = "~/MyFile/" + FileUpload1.FileName;

)O

2+

Save CB"

?B \ f+ VaD M Browse %C _ 0

! ~ " "!B \ f+

! de

Q FM ! B ?

"!H!

< " B

true

! "

?B !

?B

VaD

FileUpload1.HasFile

"!H

!H r +a

& ]G

false

AJAX
% & ]G
C

& +

BL

% ajax >c S ?a9 %

QB !P "

%D! j F vD G

?B " 1+ ajax 0 !H
"0

B"

" + !F

\
+ !F
!

? CU " ) >c S ?a9 G !9


!
+C _ R; a, "

+_

d" C
C " + !F

% SM

CB" M

?B " 2 \ % 9
r ?B !

! M S

G " >!

? CB" > !

!0 B

) d C %
)" !_

1] >

! VB

protected void Button1_Click(object sender, EventArgs e)


{
for (int i = 0; i < 1000; i++)
{
ListBox1.Items.Add("computer" + i);
}
}

?B P

1] G <

!H S G
"

ajax
"

B G T) d

UpdatePanel

" ?B R

!<

: ! VB % S 9

) d B=2 R < 9

Progress Bar M R

!<

9 1+ > I 0 > " y,+f & 1] " % GaC

ScriptManager

^Qa z t N )" !_

?B M ,B CB" >

!+?B M

a? > !

UpdatePanel

Qd " "

I ; & 19 )
, _ > ) !+?B

9T
)" !_

<asp:ScriptManager ID="ScriptManager1" runat="server">


</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server"
onclick="Button1_Click"
Text="Button" />
<br />
<br />
<asp:ListBox ID="ListBox1" runat="server"></asp:ListBox>

!
+

BG
=2
1]

</ContentTemplate>

</asp:UpdatePanel>
</div>

5 ! & + "
j F vD G

F BG
"

?B

C " + !F

)O

2 + 9 ?B M ,B CB" >

1] > ) %C _ !P " "

?B !

" + !F

VB % S !+?B
"

SQLD
9T) d

%C _ G

!+?B G %
j F vD
sql Qd "

Qd "

" T "!B v

I; 5 9

ObjectDataSource0

BG

B ?B

" C R

y,+f > ) " " P <


T ?B R

"" P <

T ?B

+ " T ?B

" 1+

! de

fS" =

" $ ) !P " "!B M)

5 9 >!

PROCEDURE0

+_ R $ "

PROCEDURE Qd " "

%D!

D'

, _ > ) jf "
>!P " L

) PROCEDURE0 " 1+

!_! 5 9 sql server " " P <

sql R 0 &

R; =

" 1+ R;

T ?B

R C ! %?
Q +? server

B !H G ! ? T ?B

d !F
r

"" P < M 1 :

; $

%C _ 0

?B " 2

?B " 2

! M
?B " 2

?B " 2

fS" ! 0 Qa z t

R; > ) , F

?B " 2

?B " 2

fS" =

=0h > ) !2

!<

7 > )!2

ALTER PROCEDURE dbo.UsersDelete


@Uid bigint
AS
DELETE FROM tUsers
WHERE

(uId = @UId)

RETURN

ALTER PROCEDURE dbo.UsersInsert


@uName nvarchar(50),
@uFamily

nvarchar(50),

@uLogonName
@uPassword

nvarchar(50),
nvarchar(50),

@IsActive int
AS
INSERT INTO tUsers
(uName, uFamily, uLogonName,
uPassword, IsActive)

!< % S

VALUES
(@uName,@uFamily,@uLogonName,@uPassword,@IsActive)
RETURN

ALTER PROCEDURE dbo.UsersSelect

AS
SELECT

uId, uName, uFamily, uLogonName, IsActive

FROM

tUsers

RETURN

ALTER PROCEDURE dbo.UsersUpdate


@uId bigint ,
@uName nvarchar(50),
@uFamily

nvarchar(50),

@uLogonName

nvarchar(50),

@IsActive int
AS

UPDATE

tUsers

SET
uName = @uName, uFamily = @uFamily,
uLogonName = @uLogonName, IsActive = @IsActive
WHERE

(uId = @uId)

RETURN

ALTER PROCEDURE dbo.UsesSelect

AS
SELECT

uId, uName, uFamily, uLogonName, IsActive

FROM

tUsers

RETURN

?B " 2

I?

C T ?9 ! 0 Qa z t

6 & ]

S % ! 0 !

<div dir="rtl">
<table

border="1">

<tr>
<td width="10%" >
:! B =
</td>
<td >

1]

"!H!

& C ?9 G > ) B

<asp:TextBox ID="TextBox1" runat="server"


Width="279px" AutoCompleteType="Search"></asp:TextBox>
<asp:RequiredFieldValidator
ValidationGroup="ASRDA" ID="RequiredFieldValidator1"
runat="server" ErrorMessage="*"
ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td >
:! B

H"

d =

</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"
Width="279px"></asp:TextBox>
<asp:RequiredFieldValidator
ValidationGroup="ASRDA" ID="RequiredFieldValidator2"
runat="server" ErrorMessage="*"
ControlToValidate="TextBox2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td >
:>! B C,B
</td>
<td>

<asp:TextBox ID="TextBox3" runat="server"


Width="279px"></asp:TextBox>
<asp:RequiredFieldValidator
ValidationGroup="ASRDA" ID="RequiredFieldValidator3"
runat="server" ErrorMessage="*"
ControlToValidate="TextBox3"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td >
:

D C,B

</td>
<td>
<asp:TextBox ID="TextBox4" runat="server"
Width="279px"></asp:TextBox>
<asp:RequiredFieldValidator
ValidationGroup="ASRDA" ID="RequiredFieldValidator4"
runat="server" ErrorMessage="*"
ControlToValidate="TextBox4"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td >
:
</td>
<td>

D C,B

<asp:TextBox ID="TextBox5" runat="server"


Width="279px"></asp:TextBox>
<asp:RequiredFieldValidator
ValidationGroup="ASRDA" ID="RequiredFieldValidator5"
runat="server" ErrorMessage="*"
ControlToValidate="TextBox5"></asp:RequiredFieldValidator>
<asp:CompareValidator
ValidationGroup="ASRDA" ControlToValidate="TextBox5"
ControlToCompare="TextBox4"

ErrorMessage=" C,B

ID="CompareValidator1" runat="server"
C 9"></asp:CompareValidator>

</td>
</tr>
<tr>
<td >
:! B % U
</td>
<td>
<asp:RadioButtonList ID="RadioButtonList1"
runat="server" RepeatDirection="Horizontal">

Value="1">

<asp:ListItem Selected="True"
F</asp:ListItem>
<asp:ListItem Value="0">! ~

F</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>

<tr>
<td colspan="2">
<asp:Button ID="Button1"
ValidationGroup="ASRDA" runat="server" Text="% J"
Width="180px" />
</td>
</tr>
</table>
</div>

)" !_

r ; " k ? Qa

1] >

!H Qa 9 )" ! *9 ! 0 Qa

!H M

R; > ) B

<asp:GridView ID="GridView1" DataSourceID="ObjectDataSource1"


AllowPaging="true"
PageSize="4" AllowSorting="true"
runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#CCCCCC" BorderStyle="None"
BorderWidth="1px" DataKeyNames="uId"
CellPadding="3" Height="210px"
GridLines="Both" Width="902px">

<RowStyle ForeColor="#000066" />


<Columns>
" =

<asp:TemplateField HeaderText="
SortExpression="uName">
<ItemTemplate>
<asp:Label ID="lbluName"
runat="server" Text='<%#Eval("uName")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtName"
runat="server" Text='<%#Bind("uName")%>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="
"> H"

<ItemTemplate>
<asp:Label ID="lbluFamily"
runat="server" Text='<%#Eval("uFamily")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtFamily"
runat="server" Text='<%#Bind("uFamily")%>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
=

<asp:TemplateField HeaderText="
">>! B
<ItemTemplate>

<asp:Label
ID="lbluLogonName" runat="server"
Text='<%#Eval("uLogonName")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox
ID="txtLogonName" runat="server"
Text='<%#Bind("uLogonName")%>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField
">% U HeaderText="
<ItemTemplate>
<asp:Label ID="lbluIsActive"
runat="server"
Text='<%#GetStatusTitle(Eval("IsActive").ToString())%>'></asp:La
bel>
</ItemTemplate>
<EditItemTemplate>
<asp:RadioButtonList
ID="RadioButtonList2" SelectedValue='<%#Bind("IsActive")%>'
runat="server"
RepeatDirection="Horizontal">
<asp:ListItem
</asp:ListItem> FValue="1">

</asp:ListItem>

<asp:ListItem
F ! ~Value="0">

</asp:RadioButtonList>
</EditItemTemplate>

</asp:TemplateField>
<asp:CommandField
ShowEditButton="True" />
<asp:CommandField
ShowDeleteButton="True" />
</Columns>
<FooterStyle BackColor="White"
ForeColor="#000066" />
<PagerStyle BackColor="White"
ForeColor="#000066" HorizontalAlign="Left" />
<SelectedRowStyle BackColor="#669999"
Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#006699" FontBold="True" ForeColor="White" />
</asp:GridView>

?B " 2 0

:! <

@AB M

? R; R "
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public class UsersProvider


{
SqlConnection MConnection = new SqlConnection();
SqlCommand MCommand = new SqlCommand();
SqlDataAdapter MAdapter = new SqlDataAdapter();
DataTable MDatatable = new DataTable();

public UsersProvider()
{

!0>) B

private void OpenConnection(string CommnadText)


{

MConnection.ConnectionString = "Data
Source=.\\SQLEXPRESS;AttachDbFilename=" + @"C:\Documents and
Settings\Administrator\Desktop\LoginTest(control in
grid)\Login.mdf" + ";Integrated Security=True;Connect
Timeout=30;User Instance=True";
MConnection.Open();
MCommand.Connection = MConnection;
MCommand.CommandType = CommandType.StoredProcedure;
MCommand.CommandText = CommnadText;
}
private void CloseConnection()
{
MConnection.Close();
}
public void UsersInsert(string uName, string uFamily, string
uLogonName, string uPassword, int IsActive)
{
OpenConnection("UsersInsert");
MCommand.Parameters.Add("@uName",
SqlDbType.NVarChar).Value = uName;
MCommand.Parameters.Add("@uFamily",
SqlDbType.NVarChar).Value = uFamily;

MCommand.Parameters.Add("@uLogonName",
SqlDbType.NVarChar).Value = uLogonName;
MCommand.Parameters.Add("@uPassword",
SqlDbType.NVarChar).Value = uPassword;
MCommand.Parameters.Add("@IsActive",
SqlDbType.Int).Value = IsActive;
MCommand.ExecuteNonQuery();
CloseConnection();
}
public void UsersUpdate(long uId, string uName, string
uFamily, string uLogonName, string uPassword, int IsActive)
{
OpenConnection("UsersUpdate");
MCommand.Parameters.Add("@uId", SqlDbType.BigInt).Value
= uId;
MCommand.Parameters.Add("@uName",
SqlDbType.NVarChar).Value = uName;
MCommand.Parameters.Add("@uFamily",
SqlDbType.NVarChar).Value = uFamily;
MCommand.Parameters.Add("@uLogonName",
SqlDbType.NVarChar).Value = uLogonName;
MCommand.Parameters.Add("@IsActive",
SqlDbType.Int).Value = IsActive;
MCommand.ExecuteNonQuery();
CloseConnection();
}
public void UsersDelete(long uId)
{
OpenConnection("UsersDelete");

MCommand.Parameters.Add("@uId", SqlDbType.BigInt).Value
= uId;
MCommand.ExecuteNonQuery();
CloseConnection();
}
public DataTable UsersSelect()
{
OpenConnection("UsersSelect");
MAdapter.SelectCommand = MCommand;
MAdapter.Fill(MDatatable);
CloseConnection();
return MDatatable;
}

"
r )" ! *9 ! 0 !

" 1+ V + " 5 9 > ! @AB G 0

! ; > ) B )" !_

1] >

! 3)

/% %1 *

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"


DeleteMethod="UsersDelete"
InsertMethod="UsersInsert"
SelectMethod="UsersSelect" TypeName="UsersProvider"
UpdateMethod="UsersUpdate">
<DeleteParameters>
<asp:Parameter Name="uId"
Type="Int64" />

</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="uId"
Type="Int64" />
<asp:Parameter Name="uName"
Type="String" />
<asp:Parameter Name="uFamily"
Type="String" />
<asp:Parameter Name="uLogonName"
Type="String" />
<asp:Parameter Name="uPassword"
Type="String" />
<asp:Parameter Name="IsActive"
Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="uName"
Type="String" />
<asp:Parameter Name="uFamily"
Type="String" />
<asp:Parameter Name="uLogonName"
Type="String" />
<asp:Parameter Name="uPassword"
Type="String" />
<asp:Parameter Name="IsActive"
Type="Int32" />
</InsertParameters>
</asp:ObjectDataSource>

8 9M

% J CB" > ) B

!d; %C _ "

protected void Button1_Click(object sender, EventArgs e)


{

ObjectDataSource1.InsertParameters["uName"].DefaultValue
= TextBox1.Text;

ObjectDataSource1.InsertParameters["uFamily"].DefaultValue =
TextBox2.Text;

ObjectDataSource1.InsertParameters["uLogonName"].DefaultValue =
TextBox3.Text;

ObjectDataSource1.InsertParameters["uPassword"].DefaultValue =
TextBox4.Text;

ObjectDataSource1.InsertParameters["IsActive"].DefaultValue =
RadioButtonList1.SelectedValue;

ObjectDataSource1.Insert();
}
public string GetStatusTitle(string StatusId)
{
");

F" : "

F !~

return (StatusId == "0" ? "


}
r

! 0

! &S

?B !

) =2

& -A]

?B M ,B ;!

>

>!

Cookies

0
C

`?

! de ^! BN%? AB %C
+_

" 1+
%

"

" 1+

B B >0

" ) B B B & 19 G

) B BG %

`9 `?B ` !` de C` !9 w B "
G` " ` ) d `

+ )%

9 DAp B " " 0 %

R; @ ";
9 DAp %

G R! B 0 C

"!B

R;

`) B B internet options %C _ 0

" !` G 0

R;

"!B
9

?B

! %

sD +

`?B o`-

B B G A7

B B

Session

! de > ! ! B M " " ) 0 a, ?B C " 1+

B B 0 ?B ! de C !9 w B "
M9 9

S %

!
R;

R;

! B +S

?B G 9 s q 9 ) B B > !

%_ !)

" +_ A7 "
! %

F -

?B

" + !F
B

F"

=2 > B $%
9

C " d +-

" > `P

> `P

" d & DAp

> ! )" ! *9

` )" !`_ = "


! `B %C`

"

" `d & DAp

C & DAp

? T+

PS Q7

? %
fS"

) B B % ? T?B
"!B 0

9 `DAp T ) `d

1] " CB" M
? = "

R; > ) B B > 9

B CI +a

! B R $ ?B ! de B B

?B " 1+ =" " g U 9 Q _ > I,KF " B

1`] " VB % a9 M

="!H

R;

R;

IC+

PS 0

?B " 2 \

1] load

! M r

1] CB" > !

; ! B %C 0 B

d " !P "

9
7

!0>) B
" T?B ! de
= "

protected void Button1_Click(object sender, EventArgs e)


{
HttpCookie _HCK = new HttpCookie("num1", "my name is javad");
Response.Cookies.Add(_HCK);
Response.Redirect("Default2.aspx");
}

protected void Page_Load(object sender, EventArgs e)


{
if (Request.Cookies["num1"] != null)
{
TextBox1.Text = Request.Cookies["num1"].Value;
}
}

?B QCD Qa G

^"

<

_" 4 0

A7 N B B R

< R 0 G 9 >!

protected void Button1_Click(object sender, EventArgs e)


{
HttpCookie _HCK = new HttpCookie("num1", "my name is javad");
_HCK.Expires = DateTime.Now.AddMinutes(10);
Response.Cookies.Add(_HCK);
Response.Redirect("Default2.aspx");
}

j `C

9 `DAp `) B "!B ) d

)O

?B !
%

_HCK.Expires = DateTime.Now;

!
+F G 0

)" !_

-R 0

B BR 0

B B s R 0R $"

C ""

S\
MSDNb
Apress.LINQ.for.Visual.C.Sharp.2008.Jun.2008b.
Microsoft Sql Server 2005 Programming For Dummies Apr 2007b3
Professional C# 2008 (Wrox - Mar 2008b
b6
Prentice.Hall.Core.Internet.Application.Development.with.ASP.NET.2.0.Feb
.2007
Wrox.Professional.ASP.NET3.5 2008b#

You might also like