csharp advanced

238
                                      

Upload: anon8908043

Post on 03-Nov-2015

258 views

Category:

Documents


0 download

TRANSCRIPT

  • mspsoftddddd

  • !"#$%

    mspsoftddddd

  • &'()*+,-+.+/(012+345467

    8(49:+/-;-+'-;+=CD126E==+D9

    8FA-;KRK!=D-/=+,S

    T%"U"VT%"TUTel :

    FWL=NFAW(.+/*34=DD;XX+

    67Y7M9*3

    D+DZ67G+[6L'\=6=2*3

    3:

    mspsoftddddd

  • 3!S

    J]^::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"T

    !"#

    $%&"'% (

    )!*+

    ),-./

    ,-for./

    ,-0"1+for.(

    "2+ 34

    ,-while33

    ,-do while3

    )5!IF3

    Else if36

    Switch3#

    )73(

    mspsoftddddd

  • Math4

    89

    89:.

    );#

    ,-foreach

    ?$>6

    ")@AB63

    ):>,CD6/

    >!E6

    @AB0#4

    Get set#6

    =!FG?$0"1+#/

    HI!F#

    I+J/

    Dialogs/.

    Timer/

    System.Collections(

    mspsoftddddd

  • )?7+!+?B(

    System.Drawing((

    K9L0"!#

    PST+?/

    PST+MD5.

    FR"!BFU!!Q.3

    )@AB>sysytem.io.6

    UserControl.(

    3.

    GJ]DD'^:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"#V

    V B3#

    V B&+"3(

    mspsoftddddd

  • GJ]!1+4_::::::^:::::::::"U"

    System.Data.OleDb.

    OleDbConnection3

    OleDbCommand6

    OleDbDataAdapterWXY

    DataTableWXZ

    !7>!HLH66

    ##

    LINQ to SQL#(

    !

  • Navigation.4

    SiteMapPath...

    FileUpload.3

    AJAX.6

    ""P

  • /4-7B()*+E9+3+467

    L=3D67(=E/4C+=+90K "2c!

  • Nb.^

    "1]GNQab3^!> !"#$$%,B?BMc!

  • """;!P)T+>`)%C `_"1`]G>`>)`d`"!`BT` S`" ! "

    #$$%$$%U9GB=gS")!B "T>F!Ha

    !+I!B%S?B"1+R;09"")!B "T!@"

    BF!H&aaR;"O2?H0"%```!"Qa`!`""\ `-G

    ";TT+dF!H&19a+-B)R;)O?B

    +S!%D!BT?B+aG>"!="S0!+O%

    1]RC)"h-NQab3^!> !"#$$%,B?BM+`d!H!`>`!

    "d?B\f+ !>2;"!B"2*9")"!!>CB"',B`M

    !9>""2"G\+B!+O ! " #$$%)dBS"!BTB

    ""a%+_`!` >"!B"`2``"`,`]``

    NQab^"G,]=!F)!?B"1+I;0%!_B""!_T

    mspsoftddddd

  • Nb^

    )i$%C _"""!_"!a )O )!H+S9,B !M>

    ()h%C _"

    !2?!> 0 =B !) " "dG)%C _" )>>U9g

    )d""T,]=!FT)"!)B""!_!>!_=!FGH"!!>R""!_

    !)>FB=!F;% IOa !>)"!_=!F!A7>R""!_C)CB"MG

    9!9?BQCDk+_>""!_1]" 9!_fS"Ra""!B2 I;

    )"?lC)G9!>,B%C _0"!B%M$$

    mspsoftddddd

  • H*9"!B)OR;))"!%C _"A79*9CB"G+!)"

    b6

    %C _0R;m)%'%C _0R;%F*9)"!

    !>?;9!9=B!)%!+I)!+O!k>*9""!_=!F!H)RO

    ?;I;TSG>B)d?;R;TC)TG*%NaQb6^C

    G!+O?;""A7+_0?B\ -G?B)CB">B"D

    OF)"C)%GB!)n"=2QCDG)"S)B>!%O"!_ !P

    H!

    $*0!G>CK9j!"!"1+o!H"2"

    mspsoftddddd

  • 0!G>9DApRdR"!B""1+%=0hB"!A7>R"!B"

    "D=

    +'0!G>H\f+)?>C9\f+j"1+q"

    ("raB0)!+?>9kSB%!C,!+?BG9!R0>9!G

    ?B)f!HA7_"!)"!M0"!M"1+G+S"G

    +a?BsT")0>F!HQ7M)a,?+ B%C _" BR;

    C)Q7"9!+?BG!C

    ?)I>sB"TI"!BI;0U9Tg)dIS7"I;%d"!

  • St,_%C _"B"!B)OQhFaS"!>BG+,

    ">"!P>!>! !B%>!+"G9>`!=!F

    "@AB!),B!P"!B%MView codeNQa`b#^=`2``a?`!`"

    Qa b/9%C _G"C !:! [2]

    Qab#

    Qab/FUu!Fj

  • )O)?a)%C _"B>>"QK1p`)@A`B`)f+BG>`,d"`I;

    )dvT"!B

    Qab(

    Qa"BtC)b()O?B)f+B)f+BG>"!`PQ`d".net framework!`_

    PB!9!+"I;+" [1]0`%B!9)f+BG`+`

    !>+-"B! +d)jf"+S>"G+d`!P``)`f+BG

    U9%""g+P$BG!T>R"d`FM`Qdll0 `"1+`R;0RC`!"T

    ?BT

    Net framework

    $%&"'%

    cS?a9%&">)!B%9Bvisual studio+``!``?B

    )f+B>"+d"0!_!)"!?!%&"!HG>wB`kKC!9

    mspsoftddddd

  • )!>0?)f!CH)>%""C!B%G`+ !P`Q`DT+

    CA7"!>"MQ7QDT+ xp`!""`

    QDT+vista Win7C!"OVaD!%,D!GC!B% ?!>M`T+

    xdQDHR;R;%+QDT+ RC)QDT+ !!`Q`Bp

    ?B0)>!+d"QDT+ !_!!?)"!HG*9QDT+ "!`B!

    "C!R;!P"!9ScS?a99!H>""+%&"!P"``)QaOG

    %")f0>%&"FB%G!Q9+G"!>F!n` `%

    "+d"%&"L0!_!)"

    "%&")QDT+ >99pkK!C)MkKTSDT+ ""!H!-T

    ! 9?P$T9"TG?! T?BT!>`+`!G+`

    &+"!R0 "?;T B)R0B>!` c,c++

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

    b3*+)!r

    !>9!]"DyODg>"?QabQCD?BT+aG``

    "&+"C)BT?BN;^T+d!H"POGwB!T`)fQ

    ?lC))BC)G>%AD"Qd"{ }"+B"999

    b

    mspsoftddddd

  • !>FBBG+)B% RC=!F@ABQd"?"AB;"G !`A7`T>!9` y`*+M`!

    ]"D:0g*+)!>"Qazt!Pb40!QCD?BT

    b4

    *+)!hQa"B!9CD&]y!?+ )>=!F@AB?"!)!Qd"

    9?B"1+I;0TST!H*+GQd")!89NIOf"B>>)d?;89T

    ^!9?By"T"1+Q_890{d!P+ ?

    +ar*+"!H=?C)!aCDa89Qd"N,^!9?By_T+)f89Qd"R;0T

    *+?B"1+!TS*+%,!)"?*+,!"1+?a

    mspsoftddddd

  • 7r!>8C"D"B!_VB% a9"?B)"r

    !>FBBG% CB"M!VB% a9M>!_!=!F)""D"CB"OFB

    !?B8CT)>R"!B,CDGFBCB"&!% >,B`"CB"`?BM``%C `_0

    properties0Event !> ,B?BM``9`,B"`M

    d!FCB""?+_"""OFCB"GA7"!BG+`d!`H` +_0@`

    >B"+"!CB">"!" "`!` +_`"

    ,B"!B!M0B!)n!"N"%89M^

    private void button1_Click(object sender, EventArgs e)

    {

    }

    "Qd")B|}"+!>B8C"D"R"!FB*+9"% !9!?By)"T

    ?B8CQ]-T\!U~*+Qd"!)"!_=!*+T!_VB% a9Qd"=!

    )"0BQ7T!r

    private void button1_Click(object sender, EventArgs e)

    {

    int i = 5;

    int j = 7;

    int add = i + j;

    textBox1.Text = add.ToString();

    }

    mspsoftddddd

  • -F5 ,B?BM"!!9!>,BCB"?BM?B)OQ]-9

    +ar!>9:Qintstring0ToString()"1+?B"R$T*+)!>y,+f

    C9"Ta)"!_!PA7Tint "stringNS">)!+BB0^VaD!C9!_T

    )"T

    Charr

    !>!9"!+BBy9!9GQCDk?BT

    char i = 'a';

    char j = 'z';

    7r

    private void button1_Click(object sender, EventArgs e)

    {

    char i = 'a';

    textBox1.Text = i.ToString();

    }

    Stringr

    )f!H+T>"!9?By!+0T"1+m??B7Tr

    private void button1_Click(object sender, EventArgs e)

    {

    string i = "Computer";

    textBox1.Text = i;

    }

    mspsoftddddd

  • +arR$Text!+:0VB% a9"%m?=0h!P0% ToString()?B"1+T

    +ar!+R"!B8Cm??>]"DQ7R"!B8C%I;R""!_T)?B"7gr

    private void button1_Click(object sender, EventArgs e)

    {

    string i = "Computer";

    string j = "My : ";

    textBox1.Text = j + i;

    }

    +ar!>9!+Qm?int"*+!P0)!Convert"1+?BTNr!++Sm?Qa

    "+int?)!+a9BQ7"DRC.3!H%,~&]G.3m^

    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();

    +ar&19int,int32,int64F!n"%I;%A7"int64 BF!nTC%%KR9"%

    S"Q]"D: !$a?%&1+g+_B% ?]"D!"BM$Bg

    )d!$"!BT"f>sF>!+O>?B*F-"T

    mspsoftddddd

  • 7rVB% a9"0"D"+F!H!UI;?B\)"!_=VB% a9"'!>G

    VB% a9B)"!_1]"CB"M+d!Htext*9\!UCB")"!!H

    +d9Label""!_text*9=""D"DI;)"!QaQ7b

    b

    !->\!UCB",B?BM0B?!

    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();

    }

    !>9QLG9?BQCD

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

    C)!!G> 9T Tr

    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();

    }

    mspsoftddddd

  • +ar+d!H"COD"DCODT_"""j0string.FormatG

    ]&"1+?Br

    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);

    !nTC BTC?""::!0"%""jC%F

    :MaxMin

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

    float 34.(.3E+3834.(.3E+38b

    double //#33(#.3.E+308 //#33(#.3.E+308b

    char z abool false true Int16 3./#/ 3./#/b

    Int Int32 ./(3#/./(3#(b

    byte .6#4

    mspsoftddddd

  • pictureBox:

    !>R""!_!=!F"VaDMMpictureBox )"!_=!F"?9fS" R;0T

    ?B!->"VaDR""!_pictureBox"""L"a%C _0a?properties0

    BackgroundImage VaD Mimport

    ?B

    BackgroundImageLayoutStretch*9)"!

    !p0Bz 9?BQCDQaG )VaD!

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

    +ar%AD0"\B"1+9CI?9&]a,?\\&]@"\?B"1+

    +d!HF?B"VaD!Q)"!_" !P?afO!?

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

    mspsoftddddd

  • +d!HGCU"F!QR+!!+"+"+d"R;")"!_R!P

    "!> ! B" !B "2 kSd""!" ?+ )),-0"1+R9

    "+"R)+d!HA7%dM"D?B8CT))9M"1+BG

    ;),-0=2H"!S"),-!H9)int!9y"!aaaT)

    8C"!B"),-S?+ )&1+B,-G)d0"!wR;T,-Tfor

    !9%&],-y0Qa!%

    !],-G!!)""MQd"|}!R;&+""?B

    ,-"!BBB%&]GfO+?B":!2B0,-BTNh"!HA7

    >)"i"D0!1]6"1+"!a,-T6!O^"S2?i!1]

    mspsoftddddd

  • ,-%!5!"?B!?%!_!5!B?G-Mi FU

    ?B!&+",-Qd""?B!h-,-""!Pi*9M!

    %!_!5!T)0""!B?!?%]0!+a$BMGM"!P-Mi FU

    ,-"?B"09BG"%!_!5!B!?!],-G

    7"r0!"D!8CT))9M!_VB% a9"Q]-?B)"

    +ar0i9,-Qd""T?B"1+T

    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

    }

    +Br!>U9!&%AD0?B"1++_T,%ADG>B!)"TR;!P

    )f!B

    !>,-!!)"8CQ]-a??!+?BListBoxO?;T!+?BM!R;0>=!F

    )"!_hB*9QaG)"!r

    int sum = 0;

    for (int i = 0; i < 1000; i++)

    {

    listBox1.Items.Add(sum);

    sum = sum + i;

    }

    textBox1.Text = sum.ToString();

    mspsoftddddd

  • S"!BBVB% !)B%&]GM"!BFUR;R;T""My

    !_H"!C"1+),-0!H"!BT)BG+T

    listBox1.Items.Add(0);

    listBox1.Items.Add(999);

    Bh-*9QaG)"!?B!!r

    int sum = 0;

    for (int i = 0; i < 1000; i++)

    {

    listBox1.Items.Add("Sum = "+sum);

    sum = sum + i;

    }

    textBox1.Text = sum.ToString();

    -McomboBox)"!_1]"0B?! SR;&199C1VB% r

    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();

    mspsoftddddd

  • 7r)dT?!M "BTSM2+ VB% )=2'T

    !> a? VB % a9 MS M)" !_ 1] " VB % !>,B =!F?B M9

    "Loadd!F =!F "G_ " B =!F B ?B" ! )d h "

    !?+_G=!F)d""SS)+VB% !,BVB% a9?BM 9 "TextChanged!FdB tC) "A_)O

    "!F,B"CB"Md!F "!BR;T0"!!B>,BCB"?BMT

    S"TextChanged0 !B">?B "VB% a9"T *9 R;!

    )"T0Bh-\dR""!"TextChanged? r

    private void textBox1_TextChanged(object sender, EventArgs e)

    {

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

    }

    ?B!!-VB% a9"?B"!+BBMA7!+BB!Ha?B"!

  • +d!H!K?D>S"B\f+VB% ?B!>?B"1+R;0"""%OH!C

    0"SelectedValueChanged"1+?B!>d!FG ! ">%C _ 0 R;

    S",BVB% ?BM9G!">C""20Qa?!r

    "0B!!K?D>f+"!_VB% a9MH"!r

    private void listBox1_SelectedValueChanged(object sender, EventArgs

    e)

    {

    textBox2.Text = listBox1.SelectedItem.ToString();

    }

    ?B!!-!>a,BI0?BMC="VB% a9"9"""j

    ),->9"9 r" ),-G0>!>d,-"M,d",-!QBp

    "O

    r7r

    mspsoftddddd

  • 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);

    }

    }

    }

    ?Bu!F,d",-BL"",d"&+"",-B%&]G"d

    !,d"+"R;!H-?Byn,-M!?" !QBpB%"G

    !),-Qd"!M,,d",-!"QB""O,-G44 !"

    !?SG"d"% 9C,B]VB% Cj)"

    9r?B)!"+9"9,-0!+CBR+?B"1"R$>!R0>hp?+ )

    0&]),-GCU"!9!9?By?+ )T)"BrN!9yint0{d

    ,-^

    int i, j;

    for ( i = 0; i < 10; i++)

    {

    for ( j = 0; j < 10; j++)

    {

    listBox1.Items.Add("test i="+i+" j="+j);

    }

    }

    mspsoftddddd

  • +d!H*9 R+B!-=H)"!"!!"%B!-=HA79&]i+=2 QCD

    ?BBtC)"i++%"i+=10""9"!>)B0>";T)

    %r

    I=I+1 I++ I+=1

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

    I=I*NI*=N

    I=I/NI/=N

    I=I-NI-=N

    N "D!)"9

    ),-9?T)VaD! Q7r

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

    ",-G>B)dO?;R;T,-TWhile!9%R;y%&]G

    while (true)

    {

    }

    09%"+!CIF!+IR,_7!GC)Q-LG?BTr

    int i = 0;

    while (i

  • +ar+d!H,-!)""{d,-0!0+"0break"1+"

    C)"A7+d!H7G+_i!!64,-0R!C)QCDLG?B7Tr

    int i = 0;

    while (i%C _"BT!)5!0?)+S""T)dgU9

    " ,-!P> B)d0"!w R; T ,- Tdo while BL%,- Q7 ,- G

    while%Qd"B,-!!)"B&19Gdo!!5!""

    do

    {

    } while (true);

    7r

    private void button1_Click(object sender, EventArgs e)

    {

    int i = 0;

    do

    {

    listBox1.Items.Add(i);

    i++;

    } while (i < 3);

    }

    b6)5!IF r

    +d!Hp!! "?BCD +" 0if "1+?BT !B "A7>

    9?B!+?B5!!> 95!> "%AD0>"1+!">!+H5!

    mspsoftddddd

  • %AD"0!+a$B!> !+H> !+a$B>%AD"0"1+

    "!>AD0%"1+"

    7r?! fO9fVB% a90"DB;B)"%%7"D1?'

    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 = "!"# "; }

    }

    "LGaa!)5!=2R;"%"=B!)"S)"%D!a?

    ! 0)

    {

    textBox2.Text = " "; }

    else if (i == 0)

    mspsoftddddd

  • {

    textBox2.Text = "# !" "; }

    }

    " else if+"Nswitch$2B!)B%!_!5!!,R;B

    ?B+"break{d"

    7r!>""DB%FF"?B!_="VB% a9"I;')"

    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;

    }

    }

    +d!H90default+"""1+?BR"!_!&]"B)0=B

    Qd"+")5!default!"

    +arD!)+!

  • break;

    case "1":

    textBox2.Text = " % "; break;

    case "3":

    textBox2.Text = ""; break;

    case "hello":

    textBox2.Text = ")+"; break;

    default:

    textBox2.Text = " &')*( "; break;

    }

    }

    +!

  • P!HySf"DT$MA7ySf"D6440"1+LG?BT

    If(i!=500){

    }

    0"?$!>70"!

  • textBox2.Text = "# * '/ ";

    }

    01+2/!34+2-/.56#73%!34.3#73

    8#08#

    3b"0"DM>CR;VaD!+F!H)"jr

    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;

    }

    b)9!1]G"D>fO9?v,7M)"r

    private void button1_Click(object sender, EventArgs e)

    {

    float a, b, c;

    a = float.Parse(textBox1.Text);

    mspsoftddddd

  • 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";

    }

    +ar0floatT)9!>OD"D>?B"1+

    #b!>B)O>%=""S"";r

    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 = " : #"; }

    /b+BF!Qr

    int i, n, factoriel = 1;

    n = int.Parse(textBox1.Text);

    for (i = 1; i

  • "g`\9r

    0o)!"89"2 ")B+d!FfO=R;Qd"!9R;!P

    &]"89%0A79T9? +BFBTQ! "DM!)?B\ -RC

    d!F89R;%_"!BT!QCDG=2RC"89)">> >u!FA7%

    ?B"B]KfB=B!)B""1]"CB"=2S?)""=B!)0

    B RO+BF\ - 0!? " Q =B !)G+BF 89 H p ?9Q

    d!Fa;R??BB:!"T)0=B!)0 +BFF??BQ89M

    +BFQCDBT+d?$!)=2QT9?B"1+R;0T?T

    "y,+f:)89C)"A7+BF89GQ+!1"DB%0=2BR;89T

    )>"!H!s89)B?+ )>CH)!>%OH!

    C)%GaC?)">PS"!)%OH!M%GaCPM"!

    )>0")%OH!U9!7I9:g0"!CH)"!>C%OH!&])"Qab.!9y

    "

    mspsoftddddd

  • b.

    9B>y,+f"9y,+f:0HS"!)>C%OH!)"

    void fact(int i, int j)

    {

    //code

    }

    void fact2(int i, string st, double b)

    {

    //code

    }

    9B>y,+f:0H!y,+f:0"!"!H

    int fact(int i, int j)

    {

    //code

    return

    }

    string fact2(int i, string st, double b)

    {

    //code

    return

    }

    7r!>? "CB""0"1+B+BF&1+S9Q'?B

    "CB""!)7G,"89Md!F&1+!+OH!??B% a9"

    !_VB?)"

    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;

    mspsoftddddd

  • for (i = 1; i 9+OH!R8 Tr

    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

  • "L! !P>89 "2rFB)!+99p89R;M)d"2

    QaQ7b3

    b3

    +ar0>G+privatepublic,>89S% )@ABv"B%0

    I;0"!

  • b

    tC)"!B-ABH"89!_"1+""2P!

    +OH089r

    +OH089"d!FR"d89!_!89Qd"5!9??B"1+h7

    +OH0890=2)"U9R;Tg)"Tr

    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));

    }

    ?Bu!F d % "+!F 89 I$ "D if I$ R$>M%

    else!d!FL"d89?B"D"?B\!U?B

    4*fact(4-1)

    mspsoftddddd

  • 89"0!_!5!"% else0B"!!"

    3*fact(2)

    "0B,-!!!"2*fact(1)

    89%!_!5!-!M""!H.\!U"Q]-"3\!U

    .""%OH!""=!H!G0&]9!

    4*3*2*1

    R0R9U"!B&JGu!Fnum=nfact=T

    b(;)r

    -):0>?B"y,+fa`+"!P`a$T

    ?B+d!HA7T"P=)TT!+9)!9m??ByBT\dA]G`%

    mspsoftddddd

  • !?G!;!T!>;G+dFB);:% ?BfO`]:0A7g

    %!+BB+":!)!P%B!%AD9"0;=TfO``?aT

    ;pfO?BT"Qab6;:"2"))OI;?B`

    !>)"FB% ;V?BfO)"!_R;"!"`k`nF

    0{d!"V0>!9B"!By

    b6

    ;!H-?B"),-)aH!_!P!9T,-M;M;T)`

    )"?BfR;T);0"1+8_)FB`0"1+`% "``V%`"R;!

    07"A7%F;T2?

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

    {

    str[j] = "Computer = " + j;

    }

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

    {

    listBox1.Items.Add(str[j]);

    }

    }

    +_;C>!9y?BsF8_">RamwB;0"d!9`>!9`B``y

    ?B*?BsF!H7>!Q_C=>0BQa!b#Q

    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;

    }

    !0>0BsF!>"=M344PF%j

    "2?"QaT)d>=0U9=9,d"+d"R;59R;cpu=

    Qa"BtC)b/)O?Bcpu!p0"@";H""z%Q]=+

    OBQa"B"%>F!n%BM,%%Nd,TB^+_)d"T+Q7

    intde="!?B&DApTNcpu^!>"HH!_+)@";M!>HH

    !_@";A7)"d644deR;"!?BNfO9+SSd)d2B"a?>=

    mspsoftddddd

  • den0"!y%QDT+ ^P?);B>!9y?B;Q7T>p44

    ?d]="N%GaCL!+O^*?BT+_+S;)""!B"sFT

    *="

    +ar)="> )sFGF0""L"!H;R"1+)="O,-G

    Foreach

    "!a,CD%,-G!B%&]G>;!]?DM9M9

  • d?B"1+"Qa"b(CR;0"1+%""j,C0,-GB%G

    =0h;p% T!>;)>">?$>=0h?9"9),-% T

    b(

    B"h,-for

    +ar+d!H

  • 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";

    }

    ;?$>r;?$>?!9M?$V>QCD;A7?a``">`?` M

    !9"V>+"B%>x)y)"++F

    mspsoftddddd

  • R$+SB" ;V:!!1]0!+"""d[5,5]`M!`+CBV

    ?B!BeQ7T[4,4]

    !>!9;y">)"0Qa?R;RdQCD!?BTr

    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];

    }

    +ar!>)";?$>I;Rd9),-0>?B"1+9"97r

    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);

    }

    mspsoftddddd

  • }

    }

    }

    !Rd!H>TIC% 9,-0foreach?B"1+r

    foreach (int i in myint)

    {

    listBox1.Items.Add(i);

    }

    "g%*Y1+S

    !>dB7%!+I)@ABTIF!GR+T"u!`F```dBM`)`9G

    +C _=B!)"B""Nt_>^00"9G">_9A7""""`B"""

    0"9R;">+h"9"M0"9!P">h-"""9P$a?+dI?

    B>I;?Bu!Fh-\dTdB9])dG?B"]R!!>`a?

    +-909]R""!_9]T)?B"&t_G+-GS9?B+_T`)

    t_B>09?GH"";""!R;9C9";"?B!G`B%

    !>C999!")!"!R0"!9G `T)

    QCD&]G?BT?!9@ABMy?B)BT`@ABR;R"RC` A7`T

    @ABmR;%_!)BG+"0Ta!I;0""1+T?BTG

    !"t_G+"! !HNobject-oriented^H??+_+`d`t_0T>

    ?B"1+TM!9R;0y?BR;0"1+T]Kd`,d"&@A`BR;`!+"

    %!+IT+1H@AB!M?B"2@A`B0T

    ?B"1+!R;""T!Gm=@ABM`"`2`?B`m`R;"TR0G

    !9Gy?BT"@ABM!P=door!9y`""9R;"BT?BG=`

    +hM!9y?BT

    mspsoftddddd

  • !>"2FB@ABM!% >c!B"!B"2,B%M[3]"!B=``@ABM

    ?BFU!fS"QaQ7b

    b

    "d@AB=color *9!)"

    mspsoftddddd

  • !>CB"add,B?BMC@AB9""2

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    namespace WindowsFormsApplication33

    {

    class color

    {

    }

    }

    m@ABh-"29$!)T)f!9@ABQd"T?By*+`,C0T`8`9`)!

    7r

    class color

    {

    public string clr;

    public int Weigh;

    }

    "!B-ABtC)*+"CD!!>!9R0m"!By+"9T!H`CD

    !9Cy"!BTC+ 9!+"!"I;T+"TC)Qd"F`@A`BG`R`9

    !+"I;+"T

    7r!h->!=!FCB"M)"!_,B"``d!FR;M?B`N>,B"R;`M

    ?B^Mm@AB0?B"2B`@A`B=B%&]G` T

    M,fS"=>@AB= QCDTnew=2R"!B)"0BQ7T!r

    private void button1_Click(object sender, EventArgs e)

    {

    color mycolor = new color();

    }

    0"1+mycolor9sD>,d"!+"@AB+"79` m`

    R;R0"0G44B)",?B?BQ7r

    mspsoftddddd

  • private void button1_Click(object sender, EventArgs e)

    {

    color mycolor = new color();

    mycolor.clr = "#2"; mycolor.Weigh = 100;

    }

    -9RC)0"1+"I;)"!_VB% a9Mr

    color mycolor = new color();

    mycolor.clr = "#2"; mycolor.Weigh = 100;

    //////////////////////////////

    textBox1.Text = mycolor.clr;

    textBox2.Text = mycolor.Weigh.ToString();

    Bu!F!&KfOG>M+d!H%G!>"G"&KfO!P!P>?B\f+

    M"P!>0!9@ABGBy?7r

    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;

    }

    mspsoftddddd

  • +ar!T+1HA_BtC)>!+")=!F)@ABN?+ )@ABT))=!F^9!2?=!F?B"2,B"d!FR;M?B="CB""

    9MR;0?B"2S,_CB""BC"29!+"+"

    !>!+",_!900{d"@AB?By??B"1+?+C)9G:

    !9y,*+)!)>CDH??*+)!9!9{d"?ByC)9

    !+"?++_?+"*+!Qd"89MNQ7,B"CB"M^!9y?BT

    "CR!PB??B"1+R;0?9!9:G,yH7?r

    mspsoftddddd

  • -"@ABM=!Pdoor"2?BR;"T*+)!!9`y`?B!`T>"`2`G

    Q_LQ7@ABQCD?BTR;=Fdoor\f+?BT

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    namespace WindowsFormsApplication33

    {

    class door

    {

    public int numberOFdoor;

    public string NTire;

    }

    }

    mspsoftddddd

  • 0@ABGM?B"2?B"1+R;07r

    private void button2_Click(object sender, EventArgs e)

    {

    door myclass = new door();

    myclass.NTire = "23"; }

    ?BFU"d@AB89M!"D"8CB>0BQ7"!H!!r

    class door

    {

    public int numberOFdoor;

    public string NTire;

    public int MYT(int i, int f)

    {

    return (i + f);

    }

    }

    0B!!>?CB" r

    private void button2_Click(object sender, EventArgs e)

    {

    door myclass = new door();

    myclass.NTire = "23"; int Y = myclass.MYT(4, 6);

    textBox1.Text = Y.ToString();

    }

    !E>r

    -ABtC)?BsDF@AB!)>,d""d!+"9+"!`P`a?

    "@AB0@ABM!E!PT!EG>%AD@AB=:AB=+HB)d!ER;0TT

    Q7Tr

    mspsoftddddd

  • namespace WindowsFormsApplication33

    {

    class door:color {

    public int numberOFdoor;

    public string NTire;

    public int MYT(int i, int f)

    {

    return (i + f);

    }

    }

    }

    @AB0r

    "!B-ABtC)+_M!9@AB0y?B%`AD0!`d;"T^N`"1+``?BT

    )f!H\d+_TM!9y?BT8_RC)*+)!)"@ABQd"`?B0T

    )0"1+?B"RC))R"+!FQT!98_+!!9y`M

    FB00?@ABQd""% ?BQCD!TNr!9@AB=T))0y^

    class color

    {

    public color(int i, string j)

    {

    this.clr = j;

    this.Weigh = i;

    }

    public string clr;

    public int Weigh;

    }

    !98_-yMR;@AB0)"?B7Tr

    mspsoftddddd

  • !E!HBG+0Q_>"!B"2?Bo-%!+I

    private void button2_Click(object sender, EventArgs e)

    {

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

    }

    +d!Hh-!98_yQ_Q7Sd+!2O"!)M!9y?B;"T>0objectde)`!

    ?BT

    +arobjectD?intB%Mde"d"!?B+S``BG9` "

    MArrayListde?B!U9R;B""T)dg

    mspsoftddddd

  • 7r!2O"&KfO? '

    !>a?!M?B"2!VB% a9>)!_1]S`_AD&]"Q

    )"!_1]"deCB"M!!>)"!_=!FQaztb.4

    b.4

    -=@ABMstud?B"2BQ70!

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    namespace WindowsFormsApplication34

    {

    class stud

    {

    public string Name;

    public string Family;

    public int StudNumber;

    public int Tel;

    }

    }

    !>deCB",B"!?BMN,B"M^;Mp444 ?B"2

    private void button1_Click(object sender, EventArgs e)

    {

    object[] MStud = new object[1000];

    }

    mspsoftddddd

  • BLG,B!)B%&]!M>deCB"&KfO!"2O`"M``dM

    ;de!"!>;"L"!H0M"1+V?B,B!)"9TCB"M``-M

    d""FUV>;de?B!TQ7r

    int i = 0;

    private void button1_Click(object sender, EventArgs e)

    {

    object[] MStud = new object[1000];

    }

    !9{dV,BCB"B%_!)9="!ByM?BST"!`%"0``M0

    !9@ABy?BSTnewC?B0BQ7T!r

    int i = 0;

    stud mystud;

    private void button1_Click(object sender, EventArgs e)

    {

    object[] MStud = new object[1000];

    }

    h!$a?new "!a%,DT?$B% ?G"0T,B!)"h-`CB"M``M

    "2?BR;T;"de!?BT+"9+aGB!)"B"2

    %&1+",_"?$!)>= a?+ )

    int i = 0;

    stud mystud;

    object[] MStud = new object[1000];

    private void button1_Click(object sender, EventArgs e)

    {

    7&-*##,)##05634#

  • private void button2_Click(object sender, EventArgs e)

    {

    for(int j=0;j

  • textBox3.Text = ii.StudNumber.ToString();

    textBox4.Text = ii.Tel.ToString();

    MessageBox.Show(" =' "); break;

    }

    }

    }

    Get{}Set{}

    )f!H*+T)!>]Kd)"@AB"?B0Tset)f!H`f@A`B0R;TT

    0get"1+?BT?lC)G9)"8_TR;?B""DA7TG?`

  • }

    set

    {

    _NUM = value;

    }

    }

    }

    *+h7"]Kd!_NUM0"1+MYNUM)"dTNvalue`R`C)>

    *+"B%!MYNUM)"!_%!_^

    private void button1_Click(object sender, EventArgs e)

    {

    myclass mc = new myclass();

    mc.MYNUM = 1394;

    textBox1.Text = mc.MYNUM.ToString();

    }

    +d!H9)"8_?B"r

    set

    {

    if (value > 0 && value < 15)

    {

    _NUM = value;

    }

    }

    )f!HF]KdMf@AB0S+*9R;)"!0Fget

    ?B"1+7r

    public class myclass

    {

    private int _NUM;

    private string _Str;

    public string Str

    {

    get

    {

    return this._Str;

    }

    }

    }

    +d!HFPM!?B"1+R;0@AB"0setI?9?B"1+7r

    public string Str

    {

    set

    mspsoftddddd

  • {

    this.Str = value;

    }

    }

    b4?$0"1+!FG=r

    s"+d)!0?$0?B"1+=!FGA7```CB"Mnext!`_1`]"

    ),B!M>d!F="1]R;"!>c!Windows Form,B?BMM=!>?B\f+"d=!F!`>

    CB"Add,B?BM

    1]!R;% a9""!_CB"Mnext*9)"!!>T)="=!FVB% a9M

    )"!_0B!!>?1]CB"

    private void button1_Click(object sender, EventArgs e)

    {

    Form2 m = new Form2();

    m.Show();

    }

    mspsoftddddd

  • BL!??+ ))@ABI!FR$B%&]G!G>!+")R;`M0

    I;"2?B89TShow() d!F=!F@AB?BT

    +d!H=!F"C!P"O""jR;899ActiveForm.Hide()?BRI?

    FormClosing,B?BM

    mspsoftddddd

  • private void Form2_FormClosing(object sender, FormClosingEventArgs e)

    {

    Application.Exit();

    }

    FormClosing0!%!=!FG+ -"!BB"+ vDvDT)h89

    0!QBO"

    +ar!>C1]"!=P?)C!=!Fa?H!_j"!%C `_0properties

    startposition=!FCenterScreen*9)"!+d!H*9=!F0+!B)"!

    maximizeBox!!False)"!_formborderstyle!!FixedSingle)"!_

    +`` d!`` H`` C=!`` F`` `` )`` `` F"O`` ""j>>=!`` F`` C"``""j``

    TransparencyKey!!=!FmControl)"!_

    mspsoftddddd

  • +a+"VaD$!)>%O

  • 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);

    }

    +ar!>"+!>0=!FM"=!F!P&]static` ?BQ`CDK`=!`F"TA7`

    !>+=!F0+M="=!FM*+M9+!!9="=!F"M?ByR;=!`F"T

    )"?BT7r="=!F"*+M9+!!9M?Byr

    public static string Str = " ";

    private void Form2_Load(object sender, EventArgs e)

    {

    textBox1.Text = Str;

    }

    )"R;=!F"?Br

    private void button1_Click(object sender, EventArgs e)

    {

    Form2.Str = "Computer..!";

    Form2 FR2 = new Form2();

    FR2.Show();

    }

    ConstS

    ?Bu!F>"0!"B)d"1+R;0)]!A7"!B>R?B-

    +JM!"H!!>?B)]{"-G?BS,aO"B2?

    """*9&]"B% ?R?B-!)]! A]QCD>R?B

    y,+f*9)"!SBL)dQ-)%J QaOGB%&]G%JM

    !9y?B"T!_R;R" 0)""1+%JR;0!"T?B!)T

    mspsoftddddd

  • 8_*9 0" !FBF " !*9 %J R;% )" !! T>!9FB )%Jy0%

    %ADconst*+Q"?B"1+R!,C0T>~)%J*9Q_!!G+"R;R"!

    %S9"R;!P>?8C7:

    const int price = 1200000;

    private void button2_Click(object sender, EventArgs e)

    {

    int hamed=price+2000;

    int nader = price * 2;

    int mahmod = price - 5000;

    }

    bBDialogs

    !>C0de`?B!`1`]>!`>

    CC""j" =C0F!!=2!GMpictureboxMopenfiledialog)"!_=!F"CB"M

    mspsoftddddd

  • -!BG>?CB" BL8`9`B%`&]G^NShowDialog`Cv`Dj

    !2?

  • *9!-!)"T>CB"MMenuStrip!_1]")"T

    0-File!>Open,B"?BM0B?R;Qd"!

    private void openToolStripMenuItem_Click(object sender, EventArgs e)

    {

    openFileDialog1.Filter = "jpegfile (*.jpg)|*.jpg|bitmap|*.bmp|

    All files (*.*)|*.*";

    openFileDialog1.ShowDialog();

    // pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;

    mspsoftddddd

  • pictureBox1.BackgroundImage =

    Image.FromFile(openFileDialog1.FileName);

    }

    7r!>BFM?+Qtxt0CVB% a9"?Bj)

    ,_7Q7!?M>)"!_=!F?9Qazt??BT

    MrichTextBoxtextbox!>)"!_=!F*9R;0)"!9Lh`-"

    !>open text,B"?"?BM0B!!>?R;

    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;

    }

    -FM?+Q"?B"2?R;""`d`fS"&D` deR;`?B!``

    !?B!opentextFR;?+Q?B\f+

    mspsoftddddd

  • +d!H dockrichTextBox1!!Fill )"!_H!"1]=C99"!

    7r

    +d!HQd"G+deVB?B!>openfiledialog` Msavefiledialog1`]"

    )"!_?BG

    private void saveToolStripMenuItem_Click(object sender, EventArgs e)

    {

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

    (*.*)|*.*";

    saveFileDialog1.ShowDialog();

    mspsoftddddd

  • System.IO.File.WriteAllText(saveFileDialog1.FileName,

    richTextBox1.Text);

    }

    ColorDialog

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

    FontDialog

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

    7r

    !>CU%O)"!_=!F"9"m%FS!>)"!_=!F

    !>,BCB"?BM0B!!>?R;

    private void button1_Click(object sender, EventArgs e)

    {

    colorDialog1.ShowDialog();

    fontDialog1.ShowDialog();

    this.BackColor = colorDialog1.Color;

    label1.Font = fontDialog1.Font;

    }

    ?B!!-!%FmM>?B\f+"d+9!F)O2

    mspsoftddddd

  • ,_B-0Qa*9!)"!+!F)O2r

    private void button1_Click(object sender, EventArgs e)

    {

    colorDialog1.ShowDialog();

    fontDialog1.ShowDialog();

    button1.BackColor = colorDialog1.Color;

    button1.Font = fontDialog1.Font;

    }

    ")d?;)!Qd"""")ST

    Timer 1-12

    mspsoftddddd

  • +d!H!>? ]dR0&"B90"O!"1+!C R;BB"

    90%" "!C>"1+)!0" B@>`9`)!0%`!C

    9!HG+%"!C`9,B`"!C`M

    ?B9d!FR;"0B"R;Qd"!

    ? r

    private void timer1_Tick(object sender, EventArgs e)

    {

    listBox1.Items.Add("Computer");

    }

    9!9)Bk>0!!>?="CB" r

    private void button1_Click(object sender, EventArgs e)

    {

    timer1.Start();

    // timer1.Enabled = true;

    }

    private void button2_Click(object sender, EventArgs e)

    {

    timer1.Stop();

    }

    mspsoftddddd

  • ?B!!!>,B&+CB"?BM99+d%_!)?BB:!!CR;

    ?By_+

    !H+d9B"dCB"R?BB:!!C9`BRC)Enabled`9!Ctrue

    ?B

    !>sF>Sd,B=!F?BMd!F=!F"S+90B"!N0 SF>^?R;Qd"

    private void Form1_Load(object sender, EventArgs e)

    {

    timer1.Start();

    }

    ?lC)G9Interval9!C!p0Bz *9)"!0BQ7!r

    private void Form1_Load(object sender, EventArgs e)

    {

    timer1.Interval = 100;

    timer1.Start();

    }

    d!&a05!f+B89">!K+fQ_jf"B>"!BR;T

    "2?)fCBT)@ABI;"!+O>,d"?BvI;T+1H))TB"!+O

    !_"1+H!!

  • 0)"A7%FU!B!N?BFUC^)@AB> d?$B"""

    9>R;?BT

    using System.Collections;

    +O[3]"GT+ =2+OFBR;0"1+% M

    R;0?B"20BQ7T!

    System.Collections.Stack Stk = new System.Collections.Stack;

    0"1+h-!"9?BFU!"!K?D+O!_!K?DHC)"!9!9G"!]?Dk!_!PH+_!)d!K?DT>

    "!+O"!BFU+O

  • "0)@AB!P>f+BGSR9)% >@A`B"`B"!`B`ArrayList!"R;H8_""!S?@ABGQCD?B

    !HS7IABv"R9""!BQ-2O"&KfOBT;"R>0objectde`!

    "!B7RC)h-0"1+ArrayList Q-?BT

    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)

    mspsoftddddd

  • {

    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;

    }

    }

    }

    }

    }

    2+ CB"Bbutton3_Click9Qa`G`*9`)"!``?`,-0FOREACH

    ?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;

    }

    }

    }

    "!B-ABtC);0"1+arraylist=2BGH"!

    mspsoftddddd

  • +ar!>a?;)!+?B?BB%!+INName^*9R;)"!!>7`B0Q_!H

    !!G>CB"button3R;=Search*9)"!B%C _" `;`

    9!+"I;+"

    private void Search_Click(object sender, EventArgs e)

    {

    }

    "g"#=b=+*S

    ")!p+BT!>dC,Qab.

    mspsoftddddd

  • b.

    !!HF5"!B!U9tdC9QaQ7)"b..

    b..

    BH+>"!B"CB%"% !A7>+B% `a90"`DM

    "VB%FS?BDVB% a9R$"B%F!+:0?B!?%m?G`

    9QCDQint99)=2ST8`9G`!+``0`]m?%`"`D:`0g

    ?"1234"!B!H?B"+G"123m""!a$"``8`_"`HT

    "%?7+$"2?)dT?I,-$T9

  • )f?B""DF!BBT"C&]G~%"+9?B""D0!Q`7

    0B!r

    private void textBox1_KeyPress(object sender, KeyPressEventArgs e)

    {

    if (!char.IsNumber(e.KeyChar))

    {

    e.Handled = true;

    }

    }

    S\dIGs"R$?+ B `+`%GaC)s`T`B&Aa`0

    !)?7+!+?BLR;BT|}try{} catch%BL)`BB%&]GRC

    Qd"try ?77++$"!!HTdRC)0!>!Qd"catch+

    )B>Qd"catch!2;""B!P>? C+-BT"T`)?7+`"

    CR;!7> ""!B"%"+!B!HBT!P!

  • }

    +d!H)?7+$B)>!>0"!finally"1+?BST`B

    "R;Qd">7?7+r

    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++;

    }

    }

    +d!H

    !%"d!K?>CIFI;9CI1`I;`BG+8_`

    QaQ7b.3

    b.3

    TB-CIFI?TQaGQCD?BTr

    private void button1_Click(object sender, EventArgs e)

    mspsoftddddd

  • {

    int i = 0;

    try

    {

    i = Convert.ToInt32(textBox1.Text);

    }

    catch(System.FormatException str)

    {

    MessageBox.Show(str.ToString());

    }

    }

    "?7+!H&]G

  • 0f+BG!R9>,CD=2F!H&aA7"!B"1+!>G+d0 "1+ VaDM

    @ABbitmap)%!F>y,+f0"1+@ABG"@ABbitmap">TI89"

    I>GetPixelSetPixeln B%S 1m R";%" a?

    FB% S9!?B>0B"7!0:MColor!9y?BT

    )"!_mR;?BT

    Color Mycolor = Color.Red;

    hB"0Qa%!r

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

    9,]mQBRGB!+"%+"!>0B"7,]m!

    Cm""jTr

    Color Clr = Color.Green;

    byte _R = Clr.R;

    byte _G = Clr.G;

    byte _B = Clr.B;

    LS0"1+FromArgb9T#///.N.6#.6#.6#^S9m?BT

    mspsoftddddd

  • 07"!fS"0VaDM"2?BT[2]!`";"`fS"mR;

    >"")deM !?BT

    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);

    }

    "!B)OBtC);BG)@AB9>%F!H=2+d!H!>

    aD?BB)"=2R;

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

    +F!H=2VaDr

    private void button1_Click(object sender, EventArgs e)

    {

    System.Drawing.Bitmap pic =(Bitmap) Bitmap.FromFile("a.jpg");

    pictureBox1.Image = Bitmap.FromFile("a.jpg"); [email protected]#!= 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,255-

    clr.G,255-clr.B));

    }

    }

    pictureBox2.Image = pic;

    }

    mspsoftddddd

  • +ar+d!HK9L0"!

  • +_C"!M"T,_M?B!8_">

    *9R;%!_B)"0!89+!F,CD89T*9&=20!)"!>

    +a?VaDM0>VaD%!_B,]*9R;` !!9`` `y`"`

    0Nu!Dp^,]VaD0!>*9%!_B 9"""!T9"

  • CDR;,` 9`)"=`2R;T

    "VaDpicturebox)"!_T=20Q_QCDG+_T)d`h=!F;` m`

    ,BVaD1"N0B!^

    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;

    }

    mspsoftddddd

  • ABB"""9,CDR;0"1+T9!>VaD`)"=`2"`dT``?T`!

    t+ Q=@ABGGraphics%!>VaDR"!BkK+?@ABG+!9R;0:M`y

    ?BT0B!)B0>,_FU?BT

    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);

    }

    -)d@%B!-T$M>t+ Q7`1]"M$BQ` S"`!`>%`

    1]&K+fR";Nx,y^0"pictureBox1_MouseMove"1+?BT

    *+"CD!!9y?B&K+fBTG)`!_R;""0`T`*+G`"`)!

    ""!PN&]"0^!>)d"1+"!BTr

    int x, y;

    private void pictureBox1_MouseMove(object sender, MouseEventArgs e)

    {

    x = e.X;

    y = e.Y;

    }

    mspsoftddddd

  • !h-@AB!T Graphics

    @ABG">1,+f89!>B%9?B)OI;U9R;&

    9?n$=B!)a?1>"

    "+07GFillRectangle"1+?aBBT+Gt+ `M0``!`

  • -)dT!dM>C1]Oaj!T>a?+_a?""P:!t""OF@a!>

    +_a?

  • !>Ts

    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;

    }

    +d!H@i$CB"OF@%H=2"!>QCDQa?BT

    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);

    mspsoftddddd

  • pictureBox1.Image = bmp;

    }

    }

    !7>B&]VaDM>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();

    }

    mspsoftddddd

  • 7r!>1]0BCVaDjH"!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;

    }

    7rB!9Bm"kr

    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);

    }

    mspsoftddddd

  • 7r5!B1VaDR"!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;

    }

    )B&]hBR$>+G%C _0Properties9MAllow unsafe

    code?BFwB!9"Q

    mspsoftddddd

  • DLLbr

    ))C)"B! )Oh"?BkS_"dllde!

    !_"1+"!"H"B!2?)`d`!""1+``I;G+d```T

    0"!wT+_dll0)!C)"T9?B"1+I;0T` +-T+d"`"R!`P

    !>"1+)"!_TG+d"dll)9)@AB0T>91+R;Q`d"+`` ?B"1` +-T

    =!F@AB"!B-ABtC)`dllNsystem.Collection^">I`AB>9`1+

    @AB,C0"ArrayListStack%C `_`!`HC:\Windows\System32

    ?B!0?:dll)d"d!)B"!B"1+I;0QDT+ ?B

    !>G+ddllFB)% !M:0ClassLibrary?B"2

    mspsoftddddd

  • -class1?Bo-R"d9?BFUfS"=@ABMT

    =@ABMMyComputer==!FMMYForm?BFU!

    mspsoftddddd

  • "d@ABQd""$M?fS" 0BA7B!%89M!+M!m?"!H

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    namespace TestDll

    {

    public class MyComputer

    {

    public string mas()

    {

    return "my name is ...!!!";

    }

    }

    }

    F+"9+aGC+-Bpublic89T)@ABT)

    !>=!FCB"M0B""!_VB% a9M!!>?CB" r

    private void button1_Click(object sender, EventArgs e)

    {

    MyComputer mc = new MyComputer();

    textBox1.Text = mc.mas();

    }

    !>,B!="!B%MBuild9dll+dC"{d!0-"

    !>2;"!B!""2FQDLL"!` `"0""`)`M "`d

    de?B!

    mspsoftddddd

  • -)dT?P$T90TGdll""?B"1+)!!PT!>c!

  • 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();

    }

    }

    }

    +d!H=)!?aFUB*9QaG)"!

    private void button1_Click(object sender, EventArgs e)

    {

    TestDll.MYForm mf = new TestDll.MYForm();

    mf.Show();

    }

    ThreadingCDCE

    mspsoftddddd

  • ")"!9kSv%C _G0"!R"!`B`

    9+ )SiRC)!p0T)z,B%)!T)0)G?B%D!`R$

    !>cpu 02""_%"!+ Tn+S1ID!BGQDT+

    %_+P$B%cpu 9)!G?BT

    "0"1+%C _GThreading)dT?P$T9T`)`+`"`?$RC)T

    ?B!")"!9!HTBtC)R$"GaCa?"+_!> ``!G

    "1!9S"!P"+"L!

  • BL]G&"B%!9"!9@AB0y?BBT@AB"GB% ?9

    !9QaT)89"V

  • 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();

    }

    )B>"!!P>?9wB%D!TS%)"!9%+!Start!"!9>"!9B:!

    "1+99p""!9R$"C!M"

    )B,C0>""!9!P%1_"2?"tdM1_>"2?BT+_R;!

    d99B"!BGT% !?B"0I9"LG>wB"1+

    "!B1_9T>J?$&)!)+9T?B)OB2T

    )B->B89"%R a TB9GIFB% ?I,"!BfOBT

    wBfOK?B!>0;=2F"jIQ>89"fOF?B"Q

    !)"!_

    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);

    mspsoftddddd

  • 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");

    }

    }

    mspsoftddddd

  • 89BLB%&]GS!)"BM,F0%wB R;d Q?B

    +)O2sF0!+CB"1+>=B+P?

    %0"1+

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

    d9!>?$&!",J"!B"2 B!9T%D!T cpu"O!

    BL progressBar B%&]G BM!TC>!"!+?BGH!TA7

    3444progressBarL"dD9R!"!B BF A7 I,>?+?Nword,txt,pdf ^F I,>

    ?Nmp3,divx,mpeg^FI,>K9!>?Nbitmap,jpg,png,gif^

    mspsoftddddd

  • S;-9!aFG"!BBFGCP$+dP$I,""j;9

    0"!OFC,B->?C+-"dR+HBH?mp30"!OF>S

    0"!OF=I1>?"'$jfG)dTgt")vGH"!>0"!wT

    FC)+-I,F!Qexe)B,>!?>de+d!$R;>BI?

    C+T)0de?B!0>!%I;>!+I"0VaD" C9k,tG!

    k,T?BBa%!Fjpgde"!!P>%!Fbmp

  • VaD"!)!)n"aS?+ )F!n!H?B9I;%?F!nB"%!9

    S!!%S"Q&19G!de""!H0!>I;%!FVaD"bmp)H

    0"!OF>%+F!P=2S"jpg0"!OF>%+F!H=2 "bmp&]G% ^0"!OF=I1BT+1H7G>

    ?;!+Ih-\dade!sFBT?B>!+CB>*?BB%QaG)%!F>1,+fQa

    H"!9r+_+!F!de!?BT!>?T) !%!FR;BT>f

    "R$CR!PdeP$ ?""!B !T??B 0 R; 9 !HA7F BTQjpgP$

    de%!9!T>? CR;BT)"j

    7rFM

    F0RdQa!>G+F"2"1+Q")0"@AB"G>"d0

    [email protected]!>fOR""F&KQ^"BLG@AB"

    B%&]GF&KfO!$Q>!$G+>"Rd;M>0)%

    !_ )!+BB;ph-)"P+ ?$ $ B "" R"d % ?$f%R$T

  • s)%_fa9a9B%0,CDT9>)=2I;TVaD!)f!Hh-T

    "=Q7+MFMdeQ?B!TR;+;>")!+BB0deT!

    ?B!T>9Q!+M;m?>+0)!+BB0.TocharArray"1+"

    +ar,P!+BB!) sxd)!+BB0M*sF%!???BG9T?

    9M?CUQR;:"de%?B!T

    0"deQBB!"!FM!fS" deCB"%+!

    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");

    }

    F-CQ+d!H"29"Mnotpad?B0?

    +d!H-9Q;M0?B%de?B!)B_!F"0BQ7!r

    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");

    }

    !-> BTFG!Q>C?B0)"j

    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;

    }

    S9R$?CUQ"=2)!+BBT>"D&]N!?>^C""jr

    +a r+1H B tC)$ C) TwB " !1]&] !9MN!?>^de ! "" A7

    !+BBNa=97 ^+_ B% "D/S+ p 9! T.?B" !?> R;%"

    )d%FN01100001^!+BBb=98C)%9!9G?BFU!Hk%"I;"

    )d";

  • +ar!+BB!)0!H3.?BTB99o!-Q"

    h-9M?CUQRBuDQaG?BTr

    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;

    }

    B>""=2h-9BT"BM>VB!)"H"9FQ0?B?h-

    T)d"LM>!BTN!>H"!>^B"H"VB!)!P++F&Q

    ?

    "h"BtC)!-",Po !+BBa=01100001 %?BP%_"!H

    CIFBC)!d;%.#,P!+BB !?%!1]R;7u!F!!HG %?BMT

    "!P9)!+BBG)!+BBQ>"!P"G"&]+_!PF$"0Q>"

  • C"deB"!B!T+_R"d)dFT?B0QR;T!1]"!d;%?BT

    ,]!+BB9!T

    !>R"!BMI;C)!d;%N10000000=128^ORN^?BT)R;Rd8_"

    N01111111=127^AndN&^?BT9S%"Q]-!Hor ,and

    ?;0"";I;Q]-!T

    ,_B-*9Q)"!r

    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");

    }

    " B!H!PF"?B0Q)!P$CCIF

  • CB-j*9QaG)"!r

    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

    $>"!BQ-h7"B0"!OFT>Da,"FR"!B+d!H"QR9"d

    9PS ) T+! T) >P>h 7 " !H A7

  • +d0"!OF>=2>CD&]?BQrNU9FgBT)" R?Dj

    !C9%R9"dID!G^

    R$C)!d;%)!+BB>,P %!1]9!+BB%O)!)"Ta!d;"G%

    de?B ! C +!HA7%&]Gcomputer9 !+BBr%1) " %

    !d;!+BB!)computede?B!!+BBr?Bo-Qa?b.

    b.

    "?$!T)"""";@ABG>0"!OF>!T)>P>r

    !>!7>"dG+R"!B9@ABRijndaelIBG)=2&_%G

    PS+T")R?B9:!+dPSC+0!+IRijndael%O:!+d"!a,CD

    PSGT+B%&]GM.6#+PSG+T)"PST+T@!

    G+B"!?B>"T)R"!BaG"0T

    7r?+MPS0"1+T+Rijndael"a?Bar

    &]!QaQab.6?B"2

  • Qa"BtC)?!GM3.C_"%FN3.+N^.6#+^9?a

    ,CDR;&Bm?!>"G+

  • 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");

    }

    n1GCB""de!G+!>FM=QCText.txt"?BF!Q%

    ,]B9R"!Ba=2=B?)EncryptTextToFiled!F"">B

    0%![1]r

    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);

    }

    }

    0B%5!!CCB"R;89!C)jr

    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;

    }

    }

  • +arPSC+"!F)Oh7"BPSM%%OH!Q_T+?+_+C>

    "!BB09+R;""!Ba?SPSIC+%OH!Q_B"""

    ??+ MD5)^"BPSG+_T++C>R;"?$CB%hash!

    +-"!H!H1]]?$\+BM>PSG)T+?$C0!B%

    S"!HG"!F!K?)B?+!)"""!F!K?BM%OH!Q_a??+

    +_A7"C%sD)PS9&]CT+md5!"

    de)!+-""dDApC0T))+_""K_C"%)

    ,_BBC0 "!!!H"?%%"C

    9"%R$>"=%J=P?)A_B%"!B)BRC)>S9

    "RADCB""!B!>"?B"1+R;0%!?CG&]md5

    !;" "OI&29"!+aS)sT)M>"2S+=2QaG

    H"!?9,fPS0T+md5 rijndeal%

    7r0B"!PS0"1++MT+md5B"

    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();

    }

  • !> T)90BQa!?BQCD?"+CB+>NB

    B"^ "!!!H"true""%OH!"

    bool verifyMd5Hash(string input, string hash)

    {

    // Hash the input.

    string hashOfInput = getMd5Hash(input); // getMd5Hash K3,L3#M)!*

    // Create a StringComparer an comare the

    hashes.

    StringComparer comparer =

    StringComparer.OrdinalIgnoreCase;

    if (0 == comparer.Compare(hashOfInput, hash))

    {

    return true;

    }

    else

    {

    return false;

    }

    }

    6+;DO!S

    +d%_ !) FM?B FU ! QF R; 0 =S 8_ " 9?B "1+ Q " R;

    Resource Filede?B!+_=2a?FI,>F!C)!"!QQC-

    "a)"!B 0>TIF%dBG)Q>kKNSetup ^ %F B&]GI,>

    !"F!PI,>"!!C)"!MFU!P?BT!>=2a?0Add New

    ItemMResource File?BFU!

  • N^ N.N^3^

    !2? " %C _ 0 0Add ResourceAdd

    Existing FileBFU!?

    ?BFU!VaD"A7

  • +_""=2a?wB!"!BQF!nF%!QF%KR+!I,FUB

    "!BFj-!CB"M>)"!_=!FN*9kKR;% a9)"!^+_9!

    >BR;,"!BMa")VaD0wBF-0"r

    N +a rFG;&] I, > 0F " I+!Qde !!P "! a?>

    +d?!>F!H7"VaDCQfO9VaD&]R;")"

    ~!]&]G;&>0I+de!?B!>R+FM"Q%!F!Pmp3

    ?BFU!^

    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 { }

    }

    """%C _GIAB!P>,d"System.IO)dv"!BT

    System.IO.File.Copyr0@AB"B+GFile!""!_>wBFa0I,F-0

    "Ra"1+!P"

    7r aD"0cdwB?BTr

  • private void button1_Click(object sender, EventArgs e)

    {

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

    }

    System.IO.File.Deleter!>FR"!BCIFRa?FM"""Q0"1++G!H"

    F,%""+Gtrue!VaD!"!H

    7r

    private void button1_Click(object sender, EventArgs e)

    {

    if (System.IO.File.Exists("c:\\pic.jpg")==true)

    {

    MessageBox.Show("file is exists");

    }

    }

    System.IO.File.Mover!>R""%B!-FM0Q>"wBQ7!PQCDS?B

    FB&19G,]QF"G+I,>?++"1S7A_B""G

    "!BQ-T

    System.IO.Directory.CreateDirectoryr!>"SF"2 M0!"1++G"

    7r

    private void button1_Click(object sender, EventArgs e)

    {

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

    }

  • : System.IO.Directory.Delete

    0!+G> R"!BFR";%I,>R" M"1+!

    7"r 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);

    }

    }

    ?lC)G9!T>2+ 0?B"1++G7TrFI,.exe "fO!r 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);

    }

    }

    7r

    !>? "9 F0*9I,")"!FB!)!G!QwB=C9"

    FI,>?BFG!Q*9fO CB"start? r {

    string x;

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

  • 0getfullpath/ )NJ * O!> #0!P !. 77)38!Q c:\\newfolder\\changeExtention.exeR

    &6'3*!>6#*/OJF=$

    foreach (string str in _M)

    {

    if (!str.EndsWith("changeExtention.exe"))

    {

    System.IO.File.Move(str,

    System.IO.Path.ChangeExtension(str, textBox1.Text));

    }

    }

    }

    System.IO.DriveInfor

    0!@ABG>"QB&KfOR";%)>wB"1+!9"

    7r

    "&KfOC)^wB%"!9NF!n%!F:%^ System.IO.DriveInfo DF = new System.IO.DriveInfo("C");

    listBox1.Items.Add(DF.DriveFormat);

    listBox1.Items.Add(DF.TotalSize);+d!H"&KfOC))>wB!9%?BQCD]Gr

    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> !?+ )8>CIFI;C)R?B!`f+B`"@=>

    RkK8_B+R;?BkK":`U"2+ f+BG

    !"9

  • UserControlr

    !F?Bu?$"=!FG"!B"1+!MA7%"1+!+O!+?B?$0=!F!)"

    =!F!)?B8CT)"D?$B""0%!+OI!FC)"GS!>I!FC)

    )B>"D"8C)!+?B>"""!_0)!HB"

    +"=!F09)G

    ?B%")!+?BBA]BGF!]% !?G"Q-!P>!>""1+a?

    BLR;0"1+UserControlB%aR;0%"?BR;0&1]C)"T

    "1+?BT

    !>BUserControlFB%C _0% New Items!R;add?B

  • )!+?B>"0>)"!_R;0Qazt!r

    !>7!"D"8CB>?CB" r

    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();

    }

    !Build?B9user controlwBtdR!H"+d"QQaM

    =user controln"!)"OaR;!>!FI)"!_R+

    ?B!!+2?

    7r%D!user control? )"!_&1]"r

  • !C9Q7,_GMuser control=clock?BFU!VB% a9M

    9!!C>)"!_=!F

    0B!!>load9?!C rN"load9F!C"^

    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();

    }

    !-build?BM!%D>I!F)"!_R+r

  • BL@ABB%&]GDateTimeR0QB&KfO!T+ "!HS!>

    ?%R0S!)"aT9M!_!C)"BBT9!C!)"B% ?44,J

    !"N9R0*9!)"!^R0!H99*9qCR;"!B!)"j+-

    99q?BFU!G0BQ7!Nrlabel!>)"!_=!F^

    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();

    }

    Media Player in CsharpWindows

  • )H&_"0!"BP?);!>?Bjf?a90,

  • +d!H-,=!FR;h8_CfS"9!9k?Bjf;a?>0string"2?B)m?);=>;""d)"!_m?);"d

    )"!_!?BSjf

  • +-9FT)Q>>?Bjf,9AaO0%

    ,Ca?"DT+ !Qwindows media player!!HkK>B

    +CB?B

    +d!H0,"d%0>kK

    ,

  • 0!de00!>,CD&DAp&>C)0I;h%`C)`%`"d!`?G

    )R0>! ,C0!>+-,CDB!=0h&>de0!>&`DAp>

    9DApM";T)!F

    ,C0Ia>9DAp!_"1+"0!BP"!"`B"!`BQBV BR9>

    )"R0?k?!h%>de0!>"?+ )&DApjfG+d0"1+```9T

    ,CDG!&>

  • 0!

    FBBG0!2?HG!2?0-!pR;"B"O9DApM`

    0"!FBBGF% ),>9DApM?BfOR;:"A7TM`T+

    9DApFPO"),>"!C2O"C2O"=?>!t2O"""G

    F),>"!CC>]:0%!+I2O"gint"\f+!`>%`!`+I=`

    :0+"\f+

    Qa.b.

    Qa"BtC).b3)O?BF),>?9"!`BT`?90`TFTFB)`,`%

    ?!2?

  • Qa.b3

    "R+!!H!P>%"09C)!pG?BQCDz"!P>0 =h-

    !FU!2?FB)O!% >,BR;`?BM`C``B"

    Sd9DAp0?)R$%%O"R;"C)02?99DAp!`>""`d`

    ?B*9?B)O&!o)GC)0B% ` ?B"&DAp2?``a,T)`fT

    !p0z,CD)"=2=0h&BT`BG`` "`0 ""V `BR`0G+

    !?0Q_GR"QKF"BvG>U9)dg?;V B+""TR$T

    ")dBV BR0!+O"!BT

    U9h-9V B""V B!2??B!T>)OGFBH% ?

    Create query by using wizard

    ?B\f+?BV BR0h-NV B&+"?;^T

    INSERT

  • 0!+"G>"R"!BFU"++"1+V"A70+"G+"!!Be!

    FU+"""[1]Qazt.b

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

    Qa.b

    0!+"G>"1+0&DApR"!B

  • !&+"0p?a"!")!tQBT!_Q`B"`5!`h`+""!HA7?)

    *9"1+"!"[1]+d!HA72O"CTKfu`D

    ?B0T"1++"G?BT

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

    "T)G+aG+"9!K?D!HBT>B)d*9R;T`)"!`T

    ,BR?DC\f+9*9R;T)"!T

    SELECT

    0!+"G>)R+\f+0"1+RCS0+"G+A7"`)R+`!>=`

    \f+2O""

    SELECT name

    FROM Table1;

    9+")G"B",]&+"R?D)R;0)!!+O"1+&+"+S"

    "kS!P>B"""9I;0?B"1+!>CIFI;R9` `helpV `B

    ?B!

    U9I?!K+f&>

  • )

    7&Y+*34#30'A#

    !

    "QKFG)d)@AB""T>"+"V` ?Bv`T`"I`AB`

    I;0"1+B"""9C

    +d!HA7+"Tinsert U9R;Q_QKF"B""g!T>

  • System.Data.OleDb

    ))@ABT+1HBtC,CDB"""

    ))

    !-)@AB>,d"))G0"!RQ]` `BG`@AB

  • "!P>"""OleDbCommandB=2BG%C _"B)">;`")`dv`RT

    "!B"!`H!-@A`B`Toledbconnection ` !`@A`BG>!>R";%0""""+G!a0)LG?BT?Bu!F

    "M+V BV"!B"2"deF-0"!B!-c!

  • Qa3b.

    !2?

    H?Microsoft Access Database File,B?BM+d!HsqlQ]`!`>H`?

    Microsoft SQL Server,B?BM+_"!B\f+V B!2?CB"ok ,B?BM`1`]"

    !)n9ConnectionString?B)OQazt3bwBR;?B``"

    ?B"1+!>%!+IR;0"1+*+M:0!String!9?BydeR;"+G`!

    ?B[4]?B"1+R;0!"9

  • Qa3b3""P"!P=2)"!F)O&19

    -?0T@ABG oledbconnection"1+P$"!>0"1+FB@ABG`% `M

    0ztR;0!""2connectionString+``!!R;>!`_` %`L`B

    U9Q_%C _"R;R";=""g

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

    Source=C:\db8.mdb";

    OleDbConnection co = new OleDbConnection();

    co.ConnectionString = str;

    GCU""@ABG>"+"!P>!>"R"!`B0`+V"R;G+ `%`_!`)%`=0h`B"

    +d+"T>"++!1V?B0R;+T?R;B=20T!9T>)"1+>"!P

    ?B"0;R;T0!+""G?+ )!

    co.Open; //insert code

    co.Close;

    OleDbCommand 3-3

    ,_%C _"BtC)+1H!T>ExecuteNonQuery"!de&!*99T?B"1+

    OleDbDataAdapter 3-4

  • 0@ABG!!+O>R"!B!0"1+@ABGFB% `M

    R;0?B"2+Filld!FR;?BT[3]0B?!r

    OleDbDataAdapter odba = new OleDbDataAdapter();

    odba.Fill(dt);

    tdhB"B)"B% ?OleDbDataAdapterCBCIFdatatable`$

    $>!?B!a?@ABR;oledbcommand` ?BkK`+?+`"`$``CI1`9T>

    0+""A7?B!+a?TwBM"0+"V+"0T`"1+`@A`BG`?BT`G

    ;&]@AB">QCD?B9+-T0%D!+"R;!]?D"+`"

    T)"!B0>"!P@ABGB%G+TdataGridView?B!

    FBBG% MdataGridViewC1]")"!_jTQa3b60B?! T

    //Filldt

    dataGridView1.DataSource = dt;

    )@AB)G,CDB"!=0h&>=2

  • Qa3b6!=2!)nQaa?>Qazt!3b#0?9!?BT"!B`B```!G`` G

    +_B%&]2O">>PO""CB"R"0!B"new`0``9`)"

    KfO2O"&>""I B% a9"B+"FURC ?lC)G9

    2O"&KfOK9Rg?B

  • 3b#

    B,-!" ?B%"RCS!T>a?"M+=Vproject.mdb?B"2

    MR""G+FV),>2O`"CH"`d=`=`"=!`9>2O`"

    Qazt3b/?B%"

  • 3b/

    =studde?B!"9d!F=G`d!`H"`+

    9I>*9fS"h"!Be)"!"%d0+F`?BR;V`!Q`

    wB?Br

    % a9CB"+"Insert~?BF!CB"OF8_9new"F

    )B->CB"5!new ]dBBT=2C)+F)">% `a9Q`d"

    "+!9Vy?BT

    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)

  • {

    con = new OleDbConnection();

    con.ConnectionString = strcon;

    cmd = new OleDbCommand();

    cmd.Connection = con;

    #!3!4#!*ZF#)[H-!'\$#*0/]'@Z=2

    a?=89M,- 2O"CR;"BT>!!`a9!H9">

    ".%)%OH!

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

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

    {

  • 89BLB%&]GV B&+":0+MH,CD"!&>=2R;

    "A7)!2?>CIF!a9R>R""!BQCDQaGBT2O`"C!H`B!`B

    "?BR;""\f+"?BMDataTable!_!?)"!HGDataTable

    V 0)

    {

    return true;

    }

    else

    return false;

    }

    )B>2O`"&K`fOR"!B

  • try

    {

    if (textBox4.Text