SlideShare une entreprise Scribd logo
1  sur  15
Télécharger pour lire hors ligne
:sgnidaeh unem gniwollof eht retnE .ti tceles ot ti no kcilc dna noci uneM eht dniF    •
                                                        .desimixaM ot etatSwodniW –
                                                       .elgniS dexiF ot elytSredroB –
                                                                .etihW ot roloCkcaB –
                                                       .noitpac eht sa smargorp yM –
                                                        .eman mrof eht sa mrf.niaM –
                                                  tes ot wodniw seitreporp eht esU        •
                        .mrof knalb a htiw tcejorp wen a nepo ot unem elif eht esU        •
                                                                  0.6 cisaBlausiV nepO    •
                                                                                1 ytivitcA
                                                   .etelpmoc uoy selpmaxe dna sesicrexe
     ynam eht ssecca uoy tel lliw taht sgnidaeh htiw erutcurts unem a fo tsisnoc lliw sihT
 .krow ruoy erots dna esinagro ot ,BV nihtiw etalpmet tcejorp a etaerc ot si pets tsrif ehT
                                                          tcejorp tsrif ruoy gnisinagrO
                                          syarra dna spool ROF detseN :21 ytivitcA
                                    pool tset-erp a ni retnuoc a gnisU :11 ytivitcA
                                            rotareneg rebmun modnaR :01 ytivitcA
                                                          spool tset-tsoP :9 ytivitcA
                                                            spool tset-erP :8 ytivitcA
                                                                            snoitaretI
                                                           syarra lortnoC :7 ytivitcA
                                                       noitceles yawitluM :6 ytivitcA
                                                                   noitceles yawitluM
                                                  retrevnoc tnemerusaeM :5 ytivitcA
                                                                     noitceleS yraniB
                                                                            ecneuqeS
                          orez yb noisivid diova dna rotaluclac a etaerC :4 ytivitcA
                                              sexob tupni dna segasseM :3 ytivitcA
                                                 snoitcnuf dna selbairav ,sepyt ataD
                                                                snoitnevnoc gnimaN
                                          srab llorcs dna sreldnah tnevE :2 ytivitcA
                                      rotide unem dna neercs emocleW :1 ytivitcA
                                           :etagivan uoy pleh yam sgnidaeh gniwollof ehT
                                               )15.p ,suballys DDS( .rennam lacidohtem
        a ni noitulos erawtfos detnemucod dna detset ylluf a tnemelpmi ot nrael stnedutS
                                                  snoitulos erawtfos fo tnempoleved
     dna ngised eht etatilicaf ot erawtfos etairporppa seilppa dna stceles tneduts A 3.5H
                                                                       emoctuo suballyS
                                                                                    .)tset
    tsop dna erp :noitareti ,yawitlum dna yranib :noitceles ,ecneuqes( serutcurts lortnoc
      evif eht etartsnomed ot sesicrexe gnicudortni dna smret yek gninifed ,tnemnorivne
gnimmargorp eht gnicudortni ,0.6 cisaB lausiV ot ediug s’rennigeb a sniatnoc lairotut sihT
                         0.6 cisaB lausiV ni gnimmargorP :lairotuT
siht
 od oT .neercs emoclew a etaerc ot nottub dnammoc a dna egami na ,slebal owt ddA          •
                     .srorre fo eerf si ti taht erusne ot >5F< nur dna krow ruoy evaS     •
                                                   End Sub
                                                       Welcome.Show
                                                   Private Sub Example1_Click()
            :edoc gniwollof eht retne dna gnidaeh unem niam 1 elpmaxE eht no kcilC        •
                                                          desimixaM ot etatSwodniW
                                                          elgniS dexiF ot elytSredroB
                                                                  etihW ot roloCkcaB
                                                                1elpmaxE ot noitpac
                                                             emocleW sa eman mrof
                                                     :seitreporp mrof gniwollof eht teS   •
              )wodniw seitreporp eht ro( mrof knalb wen a nepo ot unem elif eht esU       •
pbv.1tcejorP)slaititni ruoy( dna mrf.niaM sa krow ruoy evas ot unem eliF eht esU          •
                                .rorre morf eerf si erudecorp tiuQ eht taht dna tcerroc
si erutcurts uneM eht taht yfirev ot noitacilppa eht nur ot yek noitcnuf >5F< eht esU     •
                                                                         End Sub
                                                                 End
                                                                 Unload me
                                                     Private Sub Quit_Click()
              .sneercs ngised eht ot nruter dna yalpsid tcejorp eht gninnur morf tixe
ot desu si erudecorp sihT .edoc gniwollof eht retne dna gnidaeh unem tiuQ no kcilC        •
                           .depyt era eman dna noitpac unem hcae retfa KO kcilC
                                                              2elpmaxE
                                                              1elpmaxE
                                     fo sgnidaehbus detnedni htiw noitcudortnI
                                                                             tiuQ
.eman mrof wen eht si XXmroF erehw
                                     FormXX.Show
                                       tnemetats eht dda ,edoc erudecorp eht ot        •
                          edoc erudecorp eht wohs ot gnidaeh unem eht no kcilc         •
                                                        gnidaeh unem wen a dda         •
                                                                        rengised
   unem eht wohs ot deyalpsid mrof niam eht htiw noci unem niam eht no kcilc           •
                            wodniw seitreporp eht gnisu seitreporp mrof eht tes        •
                                                                 mrof wen a dda        •
                                                                                   :ot
deen lliw uoy tcejorp ruoy ot dedda eb ot si noitulos esicrexe dna elpmaxe wen hcae sA
                                                                unem ot mrof wen ddA
           End Sub
                   Text1.Text = “This is a procedure.”
           Public Sub Command2_Click()
                                                           .g.e ,neppah gnihtemos
    ekam ot desu dnammoc a si ,nottub a sa hcus ,tcejbo na ot dehcatta erudecorp
      A .ksat cificeps a mrofrep ot dengised stnemetats fo puorg a si erudecorp A          •
                             kcilCno egnahCno .g.e ,stcejbo neercs rehto ot kcab
  denruter era serudecorp eseht fo stluser ehT .ksat eht etelpmoc taht serudecorp
    ot atad refsnart sreldnah tnevE .neercs eht no neppah taht sgniht era stnevE           •
  .ytreporp noitpaC eht fo eulav a si ”cisaB lausiV ot emocleW“
                                  lebal fo ytreporp a si noitpaC
                                               tcejbo na si lebaL
                           erehw ”cisaB lausiV ot emocleW“ = noitpaC.lebaL .g.e
                             .eulav a sah tcejbo eht fo ytreporp hcaE .seitreporp
fo tes a sah tcejbo nA .neercs eht no sraeppa taht gnihtyna — gniht a si tcejbo nA         •
                                                             nrael ot snoitinifed emoS
                                                       srab llorcs dna sreldnah tnevE
             .KROW RUOY LLA )YPPOLF OT PU KCAB DNA( EVAS OT TEGROF T’NOD                   •
          .noitacilppa eht nur ot >5F< esu dna krow ruoy evas ot unem elif eht esU         •
                                                     Unload Welcome      –
                                                     .erudecorp )(kcilC_1dnammoC
        eht retfa edoc fo enil gniwollof eht dda dna nottub eht kcilc-elbuod nehT
.NRUTER ot noitpac sti egnahC .nottub eht dda ot noci nottuB dnammoc eht esU
                               .erutcip a tceles ot egami eht fo wodniw seitreporp
     eht esU .mrof ruoy ot egami eht dda ot xobloot ruoy no noci egami eht esU
                                                      .lebal yojnE eht dda ot taepeR
 )eulb ruolocerof ,tniop 42 ezis ,dertnec tnemngila ,enilrednu ,lairA( tnof eht teS
                                                         ruoloc kcab thgirb a esoohC
                              CISAB LAUSIV OT EMOCLEW ot noitpac eht egnahC
                            ot wodniw seitreporp eht esu ,detceles lebal eht htiW
                                        .deriuqer sa lebal ruoy eziser dna noitisop
dna mrof ruoy fo pot-ertnec eht sdrawot kcilC .xobloot eht morf noci lebal tceleS
Unload Me
     tneve )(kcilCno_ sti ot edoc gniwollof eht dda dna nottub nruter eht kcilc elbuoD .3
                                     Label4.BackColor = RGB)0, 0, HScroll3.Value)
                                     Label3.BackColor = RGB(0, HScroll2.Value, 0)
                                     Label2.BackColor = RGB(HScroll1.Value, 0, 0)
                                                             Label5.Caption = “WOW!”
                                                             Label5.Visible = True
    HScroll3.Value)
    Label5.ForeColor = RGB(255 - HScroll1.Value, 255 - HScroll2.Value, 255 -
    HScroll3.Value)
    Label1.ForeColor = RGB(255 - HScroll1.Value, 255 - HScroll2.Value, 255 -
      Label5.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
      Label1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
                                               .reisae ksat eht ekam ot etsap dna tuc
esU .tneve )(egnahCno_ sti ot edoc gniwollof eht dda dna rab llorcs hcae kcilc elbuoD .2
           .eslaf ot tes ytreporp elbisiv sti htiw nottub eht rednu 5lebal llams rehtona
                                )nruteR = noitpaC( mrof eht tiuq ot nottub dnammoc a
                                                    )eulB4 ,neerG3 ,der2( slebal rehto 3
              )552 ot eerht lla fo ytreporp eulav xam eht teS( srab llorcs latnoziroh 3
                                           )regnahC ruoloC = noitpaC( 2lebal gnidaeh A
                                                                            .mrof siht no
stcejbo gniwollof eht ecalP .regnahCruoloC ot eman sti egnahc dna mrof wen a nepO .1
                                                                              2 ytivitcA
gnl      morf epytatad regetnI fo egnar eht dnoyeb seulav regetnI             gnoL
                                           tnuoCtni .g.e 767,23 ot 867,23
         tni       – morf noitcarf ro tniop lamiced on htiw seulav ciremuN        regetnI
                                                 tnemerusaeMorciMlbd .g.e
              .noisicerp-elbuod dellac netfO .803+E23268431396797.1+
        lbd           ot 803+E23268431396797.1– morf seulav ciremuN               elbuoD
                                                             nosseLtsriFetd
        etd   .g.e 9999 ,13 ceD ot 001 ,1 naJ morf seulav emit dna etaD               etaD
                          yaPylruoHruc .g.e 7085.774,586,302,733,229$
                                        -+ ot 8085.774,586,302,733,229$-
        ruc                            morf stnuoma rallod sdloh taht ataD      ycnerruC
                                                                     egAtyb
        tyb     .g.e 652-0 morf slamiced tuohtiw seulav ciremun evitisoP            etyB
        nlb emiTrevOsInlb .g.e eslaF ro eurT .g.e .ylno seulav owt fo enO        naelooB
    xiferP                                         egnaR dna noitpircseD epytataD
                               gnirtS sA emanruSrts miD ,ycnerruC sA tsoCruc miD .g.e
                                                                epytataD sA emaNraV miD
                                                       :tnemetats MID eht fo tamrof eht
si ereH .)noisnemid rof sdnats MID erehw( selbairav eralced ot tnemetats MID a esu uoY
                                                                      .deralced eb tsum
 ti elbairav a esu nac uoy erofeb tub deen uoy sa selbairav ynam sa evah nac margorp A
 .epytatad eno dloh ylno nac elbairav A .atad sdloh taht noitacol deman a si elbairav A
                                                                         BV ni sepyt ataD
                                                        rabllorcs lacitrev     bsv
                  xob txet      txt                                  remit     rmt
                    epahs      phs                            xob erutcip       cip
           nottub noitpo       tpo                             tneilc ELO      elo
                    unem       unm                                xob tsil      tsl
                      enil      nil                                   lebal     lbl
                    egami      gmi                   rabllorcs latnoziroh      bsh
                      dirg     drg                                    mrof     mrf
                    emarf       arf                           xob tsil elif     lif
              xob tsil elif      lif                        xob tsil evird     vrd
        xob tsil yrotcerid      rid                    nottub dnammoc          dmc
               xob kcehc       khc                            xob obmoc        obc
                 lortnoC         xiferP                       lortnoC      xiferP
                                           seman lortnoC rof snoitaiverbbA xiferP
                                                eltiTlbl .ge .eman lufgninaem a yb dewollof
       ,lortnoc fo epyt eht yfitnedi ot srettel esaCrewol eerht fo xiferp a esu snoitnevnoc
       gnimaN .niatniam ro daer ot redrah edoc eht sekam ti sa ecitcarp doog ton si siht
 ,tcejorp gib a nI .cte ,1lebaL ,1txeT ,seman tluafed detpecca netfo evah ew ,won llit pU
                                                                    snoitnevnoc gnimaN
                       .pukcab dna evaS .tcejorp ruoy tset ot yek noitcnuf >5F< esU .5
                               .edoc etairporppa eht dda ot unem ruoy ni 2 elpmaxe
       kcilc elbuod dna mrof niam ruoy ot nruter ot wodniw rerolpxE tcejorP eht esU .4
.epyt ot trats uoy sa tsil nwod pord a seilppus tpmorp pleh eht sa
 meht nrael ot evah t’nod uoY .)egnahc t’nod taht seulav( slaretil ydnah emos era ereH
                     .krow ruoy evas ot tegrof t’noD .>5F< gnisu margorp ruoy nuR           •
                                                    End Sub
                                                         Form1.Show
                                                    Private Sub cmdBack_Click()
edoc eht gnisu ,regnahCruoloC eht ni did uoy sa kcaBdmc dellac ,nottub nruter a ddA         •
                                                                               End Sub
intAnswer = MsgBox(“Hello there” & strQuestion, vbOKCancel, “Chat”)
strQuestion = InputBox(“Type in your name!”, “Ebeneezer”)
                        ‘Then use the input and message box functions’
                                                      Dim intAnswer As Integer
‘First you must declare your variables’               Dim strQuestion As String
                                                  Private Sub cmdTalk_Click()
                .ecneuqes edoc gniwollof eht dda ot nottub dnammoc eht kcilc elbuoD         •
.klaTdmc nottub dnammoc eht emaN ”!em ot klaT“ noitpac eht htiw nottub dnammoc
     a evah htaenrednU .”noitasrevnoC retupmoC“ mrof eht fo pot eht no lebal a tuP          •
                                 ”sexoB tupnI dna egasseM“ = noitpaC.mroF eht ekaM          •
       ”sexoB tupnI dna egasseM“ siht llaC .mrof niam eht no gnidaeh unem a htiw mrof
  wen a etaerc ot 1 ytivitcA fo dne eht ta unem ot mrof wen ddA snoitcurtsni eht wolloF
                                                        .margorp eht htiw tcaretni ot resu
  dne eht wolla hcihw 0.6 cisaB lausiV ni snoitcnuf cisnirtni era sexob tupni dna egasseM
                                                 sexob tupni dna egasseM :3 ytivitcA
                         .sexob tupni dna sexob egassem edulcni snoitcnuf cisnirtni owT
                               .deriuqer era sisehtnerap eht ,stnemugra on sah noitcnuf
  a fi nevE .stnemugra noitcnuf eht dloh ot dne eht ta sesehtnerap evah seman noitcnuF
   .htiw krow ot atad sah noitcnuf eht os noitcnuf a ot ssap uoy eulav a si tnemugra nA
                                                     .srettel esaCrewol ro esaCreppu ot
txet gnitrevnoc sa hcus atad gnirts etalupinam srehtO .sksat lacitamehtam cisab mrofrep
  emoS .)snoitcnuf cisnirtni( snoitcnuf ni-tliub ynam sedulcni cisaB lausiV .tluser elgnis
a snruter dna stnemugra erom ro eno ,orez stpecca taht edoc fo tnemges a si noitcnuf A
        rav          eulaVlortnoCtnv .g.e .nwonknu si epytatad eht hcihw
     ro tnv      rof seulav rehto dna lortnoc rof desu epytatad yna fo ataD       tnairaV
                                                                emaNtsriFrts
                     .g.e ½ ,^ ,@ sa hcus sretcarahc laiceps gnidulcni atad
        rts   ciremunahpla fo sretcarahc 004,56 ot 0 fo stsisnoc taht ataD         gnirtS
                                                        serugiFselaSraeYgns
                              .noisicerp-elgnis dellac netfO .83+E328204,3
       gns               ot 83+E328204,3– morf egnar taht seulav ciremuN           elgniS
                                      pilCdnuoSjbo .g.e .smrof ro slortnoc
        jbo    sa hcus stcejbo secnerefer dna sdloh taht epytatad laiceps A        tcejbO
                  ecnatsiDratSgnl .g.e 746,384,741,2 ot 846,384,741,2–
End If
Else …
     IntError = MsgBox (“You cannot divide by 0!”, VbOkCancel, “Whoops!)
If Val (txtTwo.Text) = 0 Then
                    .resu eht ot melborp eht etacidni ot noitcnuf )(xoBgsM eht esU .orez
 gniretne yb ro gnihton gniretne yb rehtie ,orez yb edivid ot elbissop ton si ti taht erusnE
                               .resu eht rof noitpo na eb thgim siht ,revelc yrev era uoy fI
               lblAnswer.Caption = Format (dblAnswer, “#,##0.00”)
            .secalp lamiced owt ot ffo dednuor si rewsna erusne ot noitcnuf tamroF a esU
                                                                .rebmun dnoces rof taepeR
                             Val (txtOne.text)      dblNo1 =
                                         .elbairav eht otni eulav taht tup ot tnemetats
      tnemngissa na neht ,rebmun a ot xob tupni morf gnirts egnahc ot noitcnuf laV esU
                                                     intError As Integer
                                                     dblAnswer As Double
                                                     dblNo2 As Double
                                                     dblNo1 As Double
                                                                        :selbairav eralceD
                                                                 .)rewsnAlbl( rewsna eht
yalpsid ot lebal a dna )owTtxt dna enOtxt( sexob tupni owt esu thgim noitulos elbissop A[
                                                                                    .resu
 eht yb nevig srebmun owt edivid dna ylpitlum ,tcartbus ,dda nac taht rotaluclac a etaerC
                                                                                 4 ytivitcA
                                                             .yletelpmoc derongi si edoc fo
 enil taht ,kramer eht fo tnorf ni decalp si ‘ ro meR fI .ecnanetniam edoc rof noitamrofni
        dda ot ro edoc fo noitces a fo esoprup eht nialpxe ot edoc ni dedda era skrameR
   .esle gnihtyna gniod erofeb xob siht egdelwonkca
tsum resu ehT .xob golaid ladoM metsyS a syalpsiD            6904         ladoMmetsySbv
                 .noci egassem noitamrofnI syalpsiD            46           noitamrofnIbv
                     .noci egasseM gninraW syalpsiD            84          noitamalcxEbv
                       .noci yreuQ gninraW syalpsiD            23              noitseuQbv
                       noci egasseM lacitirC syalpsiD          61                lacitirCbv
                                         noitpircseD       eulaV       laretil demaN
                                                               sexoB egasseM ni snocI
              .snottub lecnaC dna yrteR eht syalpsiD             5         lecnaCyrteRbv
                    .snottub oN dna seY eht syalpsiD             4                oNseYbv
            .snottub lecnaC dna oN ,seY eht syalpsiD             3        lecnaCoNseYbv
       .snottub erongI dna yrteR ,trobA eht syalpsiD             2    erongIyrteRtrobAbv
          snottub lecnaC dna nottub KO eht syalpsiD              1            lecnaCKObv
                              nottub KO eht syalpsiD             0              ylnOKObv
                                         noitpircseD       eulaV       laretiL demaN
                                                             sexoB egasseM ni snottuB
).orez yb gnidivid resu a tneverp ot rotaluclac ruoy ni noitceles yranib desu evah uoY(
                                                                                 fI dnE
                                          stnemetatS cisaB lausiV erom ro enO
                                                                                    eslE
                                           stnemetats cisaB lausiV erom ro enO
                                                            nehT tset nosirapmoc fI
                                                                                              RO
                                                                                 fI dnE
                                           stnemetats cisaB lausiV erom ro enO
                                                            nehT tset nosirapmoc fI
                                                                  .cisaB lausiV ni xatnys eht si
    ereH .stnemetats   If – Else – End If     eht ro   If – End If  eht sesu noitceles yraniB
      )seciohc elpitlum( yawitluM ro )yaw owt( yraniB eb nac stcurtsnoc noitceleS .edam
  eb ot seciohc rof swolla dna tneve yna rof syawhtap elpitlum swolla noitceleS .noitceles
          — tcurtsnoc mhtirogla dnoces eht sesu etirw lliw uoy smargorp fo puorg txen ehT
                                                                              noitceles yraniB
                                              `output     End Sub
                                                              txtOne.SetFocus
                                                              lblAnswer.Caption = “”
                                                              txtTwo.Text = “”
`sequence of processes initializing variables                 txtOne.Text = “”
`user input                                               Private Sub cmdClear_Click()
                                                              .g.e ,spets ssecorp fo seires
   a dna tuptuo ,tupni fo tsisnoc dluow mhtirogla eht ,erudecorp bus hcae rof ,oS .tneve
   hcae rof yawhtap elbissop eno ylno htiw rehtona dewollof edoc fo enil hcaE .stcurtsnoc
          mhtirogla ecneuqes morf detcurtsnoc lla erew 3 — 1 seitivitcA ni smargorp ehT
                                                                        smhtirogla ecneuqeS
                             .mrof niam eht no gnidaeh unem noitceleS yraniB a ot tcennoC
                                                                   .etad eht dna eman ruoy
   sedulcni hcihw edoc ruoy fo pot eht ta )enil eht fo gninnigeb eht ta ‘ tup( kramer a ddA
                                                .tif ot hcterts lliw ti eurt ot ytreporp ezisotua
        s’lebal eht tes uoy fI ?seulav lla rof hguone gib lebal ruoy sI .cte ,sorez ,srebmun
       evitagen ,srebmun llams yrev ,srebmun gib yrev ,sregetni esU .skrow ti taht kcehC
                                                                   .pu ti ytterp ot seitreporp teS
                              .xob tupni tsrif eht ot rosruc eht snruter dohtem sucoFteS ehT
                                                                     txtOne.SetFocus
                                                                     lblAnswer.Caption = “”
                                                                     txtTwo.Text = “”
                                                                     txtOne.Text = “”
                                                                             .noitaluclac
      rehtona od ot resu eht wolla ot edoc gniwollof eht htiw nottub dnammoc raelc a ddA
egAtni esaC tceleS
                                                                              :elpmaxe roF
                                                                            tceleS dnE
                                          ]stnemetats BV erom ro enO[
                                                                     eslE esaC
                                          ]stnemetats BV erom ro enO[
                                                                  eulav esaC
                                          ]stnemetats BV erom ro enO[
                                                                  eulav esaC
                                          ]stnemetats BV erom ro enO[
                                                                  eulav esaC
                                                             noisserpxE esaC tceleS
                                         .stnemetats esaC hguorht noitceles elpitlum rof
 xatnys eht si ereH .stnemetats esaC esu ot retteb si tI .edoc daer-ot-drah ot sdael dna
   detacilpmoc semoceb siht tub stnemetats fI detsen esu nac uoy ,sevitanretla owt naht
erom sevlovni noitceles eht fI .noitceles yranib fo elpmaxe na ta dekool ew 5 ytivitcA nI
                                                                       noitceles yawitluM
 .456789000000.0 ,srebmun evitagen ,orez ,srebmun llams yrev ,srebmun egral yrev
    gnidulcni atad tset emos htiw tuo ti yrT .stluser eht yfirev ot rotaluclac ruoy esU     •
                             .yltcerroc gnikrow si ti taht erusne ot noitacilppa eht nuR    •
                                            .noitceleS yraniB gnidaeh unem ot tcennoC       •
                                                                                    .emit
  a ta detceles eb nac eno ylno .e.i ,evisulcxe yllautum era snottub noitpO .detceles
si nottub noitpo hcihw no desab esu ot alumrof hcihw enimreted ot stnemetats FI esU         •
                                       .sehcni ot sertemitnec ro sertemitnec ot sehcni si
noisrevnoc eht rehtehw etacidni ot resu eht rof )xobloot eht morf( snottub noitpo esU       •
                                                 .)sertemitnec 45.2 = hcni 1 noisrevnoc
eht gnisu( sehcni ot sertemitnec RO sertemitnec ot sehcni trevnoc ot margorp a etirW        •
                                                                      .noitceleS yawitluM
      dna noitceleS yraniB ,sgnidaehbus owt htiw snoitceleS gnidaeh unem wen a ddA          •
                                 .smc 45.2 si sertemitnec ni tnemerusaem ehT
                          !ti trevnoC
                                                          tnemerusaem eht retnE
                                                      1
                       sertemitneC ro           sehcnI ni tnemerusaem ruoy sI
                                                                                 5 ytivitcA
Label1.Caption = "Thursday"               Case Index = 3
                 Label1.Caption = "Wednesday"               Case Index = 2
                   Label1.Caption = "Tuesday"               Case Index = 1
                               Case Index = 0         Label1.Caption = "Monday"
                        Select Case optChoice (Index)
                    Private Sub optChoice_Click (Index As Integer)
  :siht ekil kool thgim erudecorp tneve kcilC eht ,eciohCtpo dellac snottub noitpo fo yarra
 lortnoc a detaerc uoy fi ,oS .seulav ytreporp xednI tnereffid gnivah yb dehsiugnitsid era
yarra eht nihtiw slortnoc laudividnI .mrof ruoy ot sexob kcehc ro snottub oidar gnidda ni
ydaerla siht deretnuocne evah yam uoY .)dnammoc etsaP dna ypoC eht gnisu yb detaerc
netfo( eman emas eht htiw epyt emas eht fo slortnoc elpitlum fo tes a si yarra lortnoc A
                                                                                7 ytivitcA
                         .gnidaeh unem yawitluM eht ot detcennoc niaga sleveLesioN
        eman eht rednu unem mrof niam eht ot siht knil dna stnemetats esaC esu niagA
                                 gnixaleR                         92 – 0
                              gnitcartsiD                         95 – 03
                              gnibrutsiD                          98 – 06
                               gninefaeD                          931 – 09
                       lufniap ylemertxE                               +041
                          level trofmoC                       level lebiceD
    .elbat gniwollof eht ni noitamrofni no desab level lebiced elbaborp eht tuptuo neht
  ,stnemmoc eht yb level esion eht esoohc ot resu a wolla ot sexob kcehc fo tes a esU .2
                                               .mrof niam ruoy ni gnidaeh unem yawitluM
        eht rednu sthgieWesaC sa siht kniL .edoc ruoy ni stnemetats esaC esU .egatsop
    eht etaluclac dna xob txet a ni thgiew eht retne ot resu a swolla taht tcejorp a ngiseD
                   20.0*thgiew yb detaluclac era smg 005 naht reivaeh era hcihw slecraP
                                   05.7$                        005 – 152
                                   00.4$                        052 – 101
                                   07.2$                        001 – 15
                                   04.1$                        05 – 0
                                    tsoC                 )marg( thgieW
   .sthgiew tnereffid nopu desab slecrap rof segrahc gniwollof eht sah eciffo tsop ehT .1
                                                                                6 ytivitcA
                                                                            tceleS dnE
                                              ”tludA“ = noitpaC.eltiTlbl
                                                                    eslE esaC
                                 ”loohcS yradnoceS“ = noitpaC.eltiTlbl
                                                              81 oT 21 esaC
                                    ”loohcS yramirP“ = noitpaC.eltiTlbl
                                                               11 oT 6 esaC
                                         ”loohcserP“ = noitpaC.eltiTlbl
                                                                 6 < sI esaC
.repeeBmrf mrof ruoy emaN .speeb fo rebmun
        taht eussi ot pooL …… elihW oD esu ,dilav si rebmun eht fI .egnar detcepxe
      eht edisni t’nsi rebmun eht fi egassem rorre na eussi dna rebmun dilav a rof xobtxet
 eht kcehc ,nottub dnammoc eht skcilc resu eht nehW .01 dna 1 neewteb rebmun a tupni
 ot resu eht gniksa xob txet eht evoba lebal a tuP .nottub dnammoc a dna xob txet a ddA
.unem niaM eht no )speeb eht tnuoC -( tset-erp — noitareti ot knil dna mrof wen a etaerC
                                                                                 8 ytivitcA
                 .ecno tsael ta snur syawla edoc eht taht os
pool eht fo dne eht ta si tem eb ot noitidnoc eht ,spool eseht ni :snoitareti tset-tsoP     •
                                                .tem reven si
noitidnoc eht fi lla ta nur ton lliw edoc eht dna pool eht fo
gninnigeb eht ta srucco tem eb ot noitidnoc eht ,spool eseht ni :snoitareti tset-erP        •
                                                                :serutcurts noitareti cisab
  2 era erehT .gnipool eht gnippots fo yaw a niatnoc TSUM noitareti hcaE .)semit
    fo rebmun detnuoc a rof ro( eurt sniamer noitidnoc emos elihw yldetaeper tuo deirrac
     eb ot stnemetats fo puorg ro tnemetats a wolla taht serutcurts era spool ro snoitaretI
                                                                                 snoitaretI
                                                                                    noitaretI
                         7 ytivitcA morf                )syad ym ruoloC-( yawitluM
                         6 ytivitcA morf                    )slevel esioN -( yawitluM
                         6 ytivitcA morf                 )sthgiew lecraP -( yawitluM
                         5 ytivitcA morf        )retrevnoC tnemerusaeM -( yraniB
                         4 ytivitcA morf                    )rotaluclac ehT -( yraniB
                                                                                    noitceleS
                         3 ytivitcA morf     )noitasrevnoC retupmoC –( ecneuqeS
                                                                   sexob tupnI dna egasseM
                         2 ytivitcA morf             )regnahc ruoloC –( 2 elpmaxE
                         1 ytivitcA morf             )BV ot emocleW –( 1 elpmaxE
                                                                   )secneuqeS( noitcudortnI
                                                                                         tiuQ
                                                                                      uneM
                                          .degnahc eb ot deen taht yna egnahc dna woleb
tsil eht kcehC .smrof tcerroc eht ot )edoc yb( deknil dna tcerroc lla era niaM no sgnidaeh
          unem eht taht kcehc — snoitareti — serutcurts tsal eht htiw eunitnoc ew erofeB
                     .syaD yM ruoloC gnidaeh eht rednu unem mrof niam eht ni gnidaeh
     noitceleS yawitluM unem eht ot kniL .yad tnereffid hcae rof )etairporppa gnihtemos
         ot( ruoloc dnuorgkcab lebal eht egnahc ot edoc dda neht ,tuo siht yrT .detceles
      saw nottub noitpo tnereffid hcae sa noitpac lebal eht egnahc dluow evoba edoc ehT
                                                                           End Sub
                                                                               End Select
                     Label1.Caption = "Sunday"                     Case Else
                  Label1.Caption = "Saturday"               Case Index = 5
                     Label1.Caption = "Friday"              Case Index = 4
.trahcwolf a sa mhtirogla siht etirW
                                                                    MARGORPNIAM DNE
                                                                     egareva yalpsid
                                                            retnuoc / mus = egareva
                                                                01 = retnuoc LITNU
                                                         1 + retnuoc = retnuoc
                                                         rebmun + mus = mus
                                                                    rebmun teg
                                                                             TAEPER
                                                                           0 = mus
                                                                        0 = retnuoc
                                                                    margorP niaM NIGEB
                                                                         egareva        O
                                                          retnuoc/mus = egareva
                                                                retnuoc ot 1 dda
                                                              mus ot rebmun dda         P
                                                                retnuoc ,rebmun         I
              :siht ekil kool thgim ,pool tset-tsop a gnisu ,draobyek eht morf deretne
     srebmun emos fo egareva eht gnidnif rof mhtirogla edocoduesp dna trahc OPI ehT
                                                            noitareti tset-tsop  •
                                                             noitareti tset-erp  •
                                                           noitceles yawitlum    •
                                                              noitceles yranib   •
                                                                     ecneuqes    •
      .serutcurts lortnoc cisab 5 eht gniniatnoc edoc gnitirw ta kool ew ,lairotut siht nI
                                                                               9 ytivitcA
                                .margorp siht rof mhtirogla edocoduesp eht etirw nehT
                                                   .margorp siht rof trahC OPI na etirW
                              End Sub
                                  End If
                                      Text1.SetFocus
                                      Text1.Text = ""
                                  Else
                                      Loop
         ‘Count down                      intNumber = intNumber - 1
                                              Next pause
                                               frmBeeper.Refresh
‘Slow down the beeps                          For pause = 0 To 2500
                                          Beep
                                      Do While intNumber > 0
   ‘Validate number               If (intNumber > 0) And (intNumber < 11) Then
 ‘Input user number                                intNumber = Val(Text1.Text)
                                                          Dim pause As Integer
 ‘Declare variables                                       Dim intNumber As Integer
                                                      Private Sub Command1_Click()
.modnar osla
     si srebmun modnar fo ecneuqes hcae fo trats eht taht serusne tnemetats ezimodnaR ehT
                                   x = Int (Rnd*100 + 51)
             .051 ot 15 morf egnar eht ni sregetni modnar secudorp tnemetats gniwollof ehT
                                       x = Int(Rnd * N)
                  xatnys gniwollof eht esu ,N < x =< 0 erehw x regetni modnar a ecudorp oT
                                                                  .ecid eht lloR … spooL tset
      tsoP … snoitaretI rednu )niaM( mrof unem eht morf margorp eht ot knil a etaerC .)lluf
       si xob erutcip eht litnu( semit lareves nottub dnammoc eht gnikcilc margorp ruoy nuR
                                                        End Sub
                                                             Loop Until x <> 6
                                                                 Picture1 Print x;
                                                                 x = Int(Rnd * 6 + 1)
                                                                                    Do
‘ Ensures the start of each sequence of random numbers is also randomised
Randomize
                                                                     Picture1 Print
                                                              x = 0
                                                              Dim x As Integer
                                                         Private Sub Command1_Click()
                                            .ti dniheb edoc gniwollof eht htiw nottub dnammoc
    a dna eurt ot tes ytreporp ezisotuA eht htiw xob erutcip egral a deen lliw mrof ruoY .ecid
         a fo gnillor eht etalumis ot 6 dna 1 neewteb rebmun modnar a etareneg ot mrof wen
       a no noitacilppa na etirW .rebmun modnar a etareneg ot )(dnR noitcnuf wen a esU
                                                                                  01 ytivitcA
                                                              .rewsna ruoy nialpxE ?margorp
            ruoy hsarc dna orez yb noisivid esuac reven lliw retnuoc eht taht erus eb uoy naC
                                                                             intCounter = 0
                                                                             intNumber = 0
                              .erudecorp eht fo gninnigeb eht ta 0 ot selbairav ruoy esilaitinI
                                                              Dim strNumber As String      .g.e
                               .stnemetats miD htiw selbairav ruoy lla eralced ot tegrof t’noD
           intNumber = Val(strNumber)
           strNumber = InputBox(“Enter the next number.”, “Enter your numbers.”)
           :xatnys eht gnisu xob tupni na htiw rof deksa eb thgim rebmun hcaE .srebmun ot
     sgnirts trevnoc ot noitcnufVal ()   eht esu ot rebmemeR .rebmun hcae rof ksa ot     Until
          Do …..Loop   xatnys eht htiw pool tset-tsop a gnisu resu eht yb deretne srebmun 01
      fo egareva eht yalpsid ot noitacilppa na etirW .segarevA … spooL tset-tsoP … snoitaretI
         rednu )niaM( mrof unem eht morf margorp eht ot knil a etaerc dna mrof wen a nepO
regetnI sA ]21,21[selbaTrra miD
                      :tnemetats eht deen uoy ,elbairav ruoy eralced oT .meht gnikcehc
   dna smhtirogla ruoy gnitirw ,tsrif repap no tuo eno siht tolp ot deen yletinifed lliw uoY
                                  .yalpsid eht no elbat semit wen hcae rof enil wen a htiw
                         ]... ]elbairav[ ,elbairav( tnirP yalpsiDcip
                  :xatnys eht gnisu lortnoc erutcip a otni 21 – 1 morf selbat semit eht tuo
tnirp ot neht dna yarra lanoisnemid 2 a llif ot spool roF detsen sesu taht margorp a etirW
                                                                               21 ytivitcA
                  .trahcwolf a sa dna edocoduesp ni mhtirogla eht dna trahc OPI na etirW
   Loop
        End If
              ‘This creates a new line
              Picture1 Print
        If Counter = 10 Then
        Counter = Counter + 2
        FibNext = FibNext + FibNumber
        FibNumber = FibNumber + FibNext
        Picture1 Print FibNext & ", "
        ‘trailing semicolon stops the Print method going to the next line.
        Picture1 Print FibNumber & ", ";
   Do While Counter < 20
                                        Picture1 Print "Ist 20 Fibonacci Numbers"
                                                                          FibNext = 1
                                                                          FibNumber = 0
                                                                          ‘Initialise
            Dim FibNumber As Integer, FibNext As Integer, Counter As Integer
                        .uoy pleh ot edoc gniwollof eht esU .roloCeroF eht morf tnereffid
  si roloCkcaB eht taht dna eurT = wardeRotuA ,eslaF = tnerapsnarT tnoF.xoBerutciP eht
 erus ekaM .ot stluser ruoy tnirp ot xoB erutciP a ddA .snoitareti fo rebmun eht lortnoc
ot retnuoc a esu emit sihT .srebmun iccanobiF 02 tsrif eht etareneg ot margorp a etaerC
                                                                               11 ytivitcA
                                                                             .seod margorp
eht ni enil yreve tahw snialpxe taht edocoduesp ni noitacilppa siht rof mhtirogla eht etirW
                                                              LITNU .…… TAEPER
                                                               xatnys edocoduesp eht ot
tnelaviuqe htob era esehT .ecno tsael ta etucexe tsum pool eht ni edoc eht taht gninaem
    pool eht fo mottob eht ta sraeppa tset nosirapmoc eht erehw spool tset-tsop era htoB
                                      Do ……. Loop While (comparison test)          •
                                      Do ……. Loop Until (comparison test)          •
                                                                                 :snoitareti
        tset-tsop rof stnemetats xatnys tnereffid owt sah cisaB lausiV taht eciton lliw uoY
drofpmaS yelreveB
                                                        yb deraperp saw krow sihT
                     mth.golatac/ten.de-eerf.www//:ptth :golataC esruoC teN dE-eerF
                                                           /moc.bvhcraes.www//:ptth
:moc.tegraThceT yb detneserp enignE hcraeS dna latroP cificepS BV ehT ,moc.BVhcraes
             .yelseW-nosiddA :sttesuhcassaM ,gnidaeR .0.6 cisaB lausiV ni snoitacilppa
        htiw slatnemadnuf gnimmargorp retupmoC .)0002( .R ,nworB dna .M ,namreK
                                                                 secruoseR rehtruF
        noitamrofnyL :DLQ ,dleifsnaM .cisaB lausiV ot noitcudortni nA .)9991( I ,hcnyL
                                                                        yhpargoilbiB

Contenu connexe

Tendances

Dictionary of parasitology
Dictionary of parasitologyDictionary of parasitology
Dictionary of parasitologynizhgma.ru
 
Fossili i reperti della rasa di varese
Fossili i reperti della rasa di vareseFossili i reperti della rasa di varese
Fossili i reperti della rasa di vareseIniziativa 21058
 
Cirp design-2011-paper34
Cirp design-2011-paper34Cirp design-2011-paper34
Cirp design-2011-paper34Roger Atkins
 
Destinazione Italia: decreto convertito in legge
Destinazione Italia: decreto convertito in leggeDestinazione Italia: decreto convertito in legge
Destinazione Italia: decreto convertito in leggeParma Couture
 
Ise viii-ad-hoc networks [10 is841]-notes
Ise viii-ad-hoc  networks [10 is841]-notesIse viii-ad-hoc  networks [10 is841]-notes
Ise viii-ad-hoc networks [10 is841]-notesVivek Maurya
 

Tendances (7)

Enterobacteriace
EnterobacteriaceEnterobacteriace
Enterobacteriace
 
Dictionary of parasitology
Dictionary of parasitologyDictionary of parasitology
Dictionary of parasitology
 
Fossili i reperti della rasa di varese
Fossili i reperti della rasa di vareseFossili i reperti della rasa di varese
Fossili i reperti della rasa di varese
 
Cirp design-2011-paper34
Cirp design-2011-paper34Cirp design-2011-paper34
Cirp design-2011-paper34
 
Destinazione Italia: decreto convertito in legge
Destinazione Italia: decreto convertito in leggeDestinazione Italia: decreto convertito in legge
Destinazione Italia: decreto convertito in legge
 
MICROWAVE AND RADAR
MICROWAVE AND RADARMICROWAVE AND RADAR
MICROWAVE AND RADAR
 
Ise viii-ad-hoc networks [10 is841]-notes
Ise viii-ad-hoc  networks [10 is841]-notesIse viii-ad-hoc  networks [10 is841]-notes
Ise viii-ad-hoc networks [10 is841]-notes
 

Dernier

محاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdf
محاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdfمحاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdf
محاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdfKhaled Elbattawy
 
Bahare Shariat Jild 4 By SadurshSharia Mufti Amjad Ali Azmi
Bahare Shariat Jild 4 By SadurshSharia Mufti Amjad Ali AzmiBahare Shariat Jild 4 By SadurshSharia Mufti Amjad Ali Azmi
Bahare Shariat Jild 4 By SadurshSharia Mufti Amjad Ali Azmibookbahareshariat
 
Bahare Shariat Jild 2 By SadurshSharia Mufti Amjad Ali Azmi
Bahare Shariat Jild 2 By SadurshSharia Mufti Amjad Ali AzmiBahare Shariat Jild 2 By SadurshSharia Mufti Amjad Ali Azmi
Bahare Shariat Jild 2 By SadurshSharia Mufti Amjad Ali Azmibookbahareshariat
 
Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...
Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...
Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...Eesti Loodusturism
 
Bahare Shariat Jild 1 By SadurshSharia Mufti Amjad Ali Azmi
Bahare Shariat Jild 1 By SadurshSharia Mufti Amjad Ali AzmiBahare Shariat Jild 1 By SadurshSharia Mufti Amjad Ali Azmi
Bahare Shariat Jild 1 By SadurshSharia Mufti Amjad Ali Azmibookbahareshariat
 

Dernier (6)

Energy drink .
Energy drink                           .Energy drink                           .
Energy drink .
 
محاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdf
محاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdfمحاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdf
محاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdf
 
Bahare Shariat Jild 4 By SadurshSharia Mufti Amjad Ali Azmi
Bahare Shariat Jild 4 By SadurshSharia Mufti Amjad Ali AzmiBahare Shariat Jild 4 By SadurshSharia Mufti Amjad Ali Azmi
Bahare Shariat Jild 4 By SadurshSharia Mufti Amjad Ali Azmi
 
Bahare Shariat Jild 2 By SadurshSharia Mufti Amjad Ali Azmi
Bahare Shariat Jild 2 By SadurshSharia Mufti Amjad Ali AzmiBahare Shariat Jild 2 By SadurshSharia Mufti Amjad Ali Azmi
Bahare Shariat Jild 2 By SadurshSharia Mufti Amjad Ali Azmi
 
Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...
Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...
Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...
 
Bahare Shariat Jild 1 By SadurshSharia Mufti Amjad Ali Azmi
Bahare Shariat Jild 1 By SadurshSharia Mufti Amjad Ali AzmiBahare Shariat Jild 1 By SadurshSharia Mufti Amjad Ali Azmi
Bahare Shariat Jild 1 By SadurshSharia Mufti Amjad Ali Azmi
 

Visualbasic tutorial

  • 1. :sgnidaeh unem gniwollof eht retnE .ti tceles ot ti no kcilc dna noci uneM eht dniF • .desimixaM ot etatSwodniW – .elgniS dexiF ot elytSredroB – .etihW ot roloCkcaB – .noitpac eht sa smargorp yM – .eman mrof eht sa mrf.niaM – tes ot wodniw seitreporp eht esU • .mrof knalb a htiw tcejorp wen a nepo ot unem elif eht esU • 0.6 cisaBlausiV nepO • 1 ytivitcA .etelpmoc uoy selpmaxe dna sesicrexe ynam eht ssecca uoy tel lliw taht sgnidaeh htiw erutcurts unem a fo tsisnoc lliw sihT .krow ruoy erots dna esinagro ot ,BV nihtiw etalpmet tcejorp a etaerc ot si pets tsrif ehT tcejorp tsrif ruoy gnisinagrO syarra dna spool ROF detseN :21 ytivitcA pool tset-erp a ni retnuoc a gnisU :11 ytivitcA rotareneg rebmun modnaR :01 ytivitcA spool tset-tsoP :9 ytivitcA spool tset-erP :8 ytivitcA snoitaretI syarra lortnoC :7 ytivitcA noitceles yawitluM :6 ytivitcA noitceles yawitluM retrevnoc tnemerusaeM :5 ytivitcA noitceleS yraniB ecneuqeS orez yb noisivid diova dna rotaluclac a etaerC :4 ytivitcA sexob tupni dna segasseM :3 ytivitcA snoitcnuf dna selbairav ,sepyt ataD snoitnevnoc gnimaN srab llorcs dna sreldnah tnevE :2 ytivitcA rotide unem dna neercs emocleW :1 ytivitcA :etagivan uoy pleh yam sgnidaeh gniwollof ehT )15.p ,suballys DDS( .rennam lacidohtem a ni noitulos erawtfos detnemucod dna detset ylluf a tnemelpmi ot nrael stnedutS snoitulos erawtfos fo tnempoleved dna ngised eht etatilicaf ot erawtfos etairporppa seilppa dna stceles tneduts A 3.5H emoctuo suballyS .)tset tsop dna erp :noitareti ,yawitlum dna yranib :noitceles ,ecneuqes( serutcurts lortnoc evif eht etartsnomed ot sesicrexe gnicudortni dna smret yek gninifed ,tnemnorivne gnimmargorp eht gnicudortni ,0.6 cisaB lausiV ot ediug s’rennigeb a sniatnoc lairotut sihT 0.6 cisaB lausiV ni gnimmargorP :lairotuT
  • 2. siht od oT .neercs emoclew a etaerc ot nottub dnammoc a dna egami na ,slebal owt ddA • .srorre fo eerf si ti taht erusne ot >5F< nur dna krow ruoy evaS • End Sub Welcome.Show Private Sub Example1_Click() :edoc gniwollof eht retne dna gnidaeh unem niam 1 elpmaxE eht no kcilC • desimixaM ot etatSwodniW elgniS dexiF ot elytSredroB etihW ot roloCkcaB 1elpmaxE ot noitpac emocleW sa eman mrof :seitreporp mrof gniwollof eht teS • )wodniw seitreporp eht ro( mrof knalb wen a nepo ot unem elif eht esU • pbv.1tcejorP)slaititni ruoy( dna mrf.niaM sa krow ruoy evas ot unem eliF eht esU • .rorre morf eerf si erudecorp tiuQ eht taht dna tcerroc si erutcurts uneM eht taht yfirev ot noitacilppa eht nur ot yek noitcnuf >5F< eht esU • End Sub End Unload me Private Sub Quit_Click() .sneercs ngised eht ot nruter dna yalpsid tcejorp eht gninnur morf tixe ot desu si erudecorp sihT .edoc gniwollof eht retne dna gnidaeh unem tiuQ no kcilC • .depyt era eman dna noitpac unem hcae retfa KO kcilC 2elpmaxE 1elpmaxE fo sgnidaehbus detnedni htiw noitcudortnI tiuQ
  • 3. .eman mrof wen eht si XXmroF erehw FormXX.Show tnemetats eht dda ,edoc erudecorp eht ot • edoc erudecorp eht wohs ot gnidaeh unem eht no kcilc • gnidaeh unem wen a dda • rengised unem eht wohs ot deyalpsid mrof niam eht htiw noci unem niam eht no kcilc • wodniw seitreporp eht gnisu seitreporp mrof eht tes • mrof wen a dda • :ot deen lliw uoy tcejorp ruoy ot dedda eb ot si noitulos esicrexe dna elpmaxe wen hcae sA unem ot mrof wen ddA End Sub Text1.Text = “This is a procedure.” Public Sub Command2_Click() .g.e ,neppah gnihtemos ekam ot desu dnammoc a si ,nottub a sa hcus ,tcejbo na ot dehcatta erudecorp A .ksat cificeps a mrofrep ot dengised stnemetats fo puorg a si erudecorp A • kcilCno egnahCno .g.e ,stcejbo neercs rehto ot kcab denruter era serudecorp eseht fo stluser ehT .ksat eht etelpmoc taht serudecorp ot atad refsnart sreldnah tnevE .neercs eht no neppah taht sgniht era stnevE • .ytreporp noitpaC eht fo eulav a si ”cisaB lausiV ot emocleW“ lebal fo ytreporp a si noitpaC tcejbo na si lebaL erehw ”cisaB lausiV ot emocleW“ = noitpaC.lebaL .g.e .eulav a sah tcejbo eht fo ytreporp hcaE .seitreporp fo tes a sah tcejbo nA .neercs eht no sraeppa taht gnihtyna — gniht a si tcejbo nA • nrael ot snoitinifed emoS srab llorcs dna sreldnah tnevE .KROW RUOY LLA )YPPOLF OT PU KCAB DNA( EVAS OT TEGROF T’NOD • .noitacilppa eht nur ot >5F< esu dna krow ruoy evas ot unem elif eht esU • Unload Welcome – .erudecorp )(kcilC_1dnammoC eht retfa edoc fo enil gniwollof eht dda dna nottub eht kcilc-elbuod nehT .NRUTER ot noitpac sti egnahC .nottub eht dda ot noci nottuB dnammoc eht esU .erutcip a tceles ot egami eht fo wodniw seitreporp eht esU .mrof ruoy ot egami eht dda ot xobloot ruoy no noci egami eht esU .lebal yojnE eht dda ot taepeR )eulb ruolocerof ,tniop 42 ezis ,dertnec tnemngila ,enilrednu ,lairA( tnof eht teS ruoloc kcab thgirb a esoohC CISAB LAUSIV OT EMOCLEW ot noitpac eht egnahC ot wodniw seitreporp eht esu ,detceles lebal eht htiW .deriuqer sa lebal ruoy eziser dna noitisop dna mrof ruoy fo pot-ertnec eht sdrawot kcilC .xobloot eht morf noci lebal tceleS
  • 4. Unload Me tneve )(kcilCno_ sti ot edoc gniwollof eht dda dna nottub nruter eht kcilc elbuoD .3 Label4.BackColor = RGB)0, 0, HScroll3.Value) Label3.BackColor = RGB(0, HScroll2.Value, 0) Label2.BackColor = RGB(HScroll1.Value, 0, 0) Label5.Caption = “WOW!” Label5.Visible = True HScroll3.Value) Label5.ForeColor = RGB(255 - HScroll1.Value, 255 - HScroll2.Value, 255 - HScroll3.Value) Label1.ForeColor = RGB(255 - HScroll1.Value, 255 - HScroll2.Value, 255 - Label5.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value) Label1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value) .reisae ksat eht ekam ot etsap dna tuc esU .tneve )(egnahCno_ sti ot edoc gniwollof eht dda dna rab llorcs hcae kcilc elbuoD .2 .eslaf ot tes ytreporp elbisiv sti htiw nottub eht rednu 5lebal llams rehtona )nruteR = noitpaC( mrof eht tiuq ot nottub dnammoc a )eulB4 ,neerG3 ,der2( slebal rehto 3 )552 ot eerht lla fo ytreporp eulav xam eht teS( srab llorcs latnoziroh 3 )regnahC ruoloC = noitpaC( 2lebal gnidaeh A .mrof siht no stcejbo gniwollof eht ecalP .regnahCruoloC ot eman sti egnahc dna mrof wen a nepO .1 2 ytivitcA
  • 5. gnl morf epytatad regetnI fo egnar eht dnoyeb seulav regetnI gnoL tnuoCtni .g.e 767,23 ot 867,23 tni – morf noitcarf ro tniop lamiced on htiw seulav ciremuN regetnI tnemerusaeMorciMlbd .g.e .noisicerp-elbuod dellac netfO .803+E23268431396797.1+ lbd ot 803+E23268431396797.1– morf seulav ciremuN elbuoD nosseLtsriFetd etd .g.e 9999 ,13 ceD ot 001 ,1 naJ morf seulav emit dna etaD etaD yaPylruoHruc .g.e 7085.774,586,302,733,229$ -+ ot 8085.774,586,302,733,229$- ruc morf stnuoma rallod sdloh taht ataD ycnerruC egAtyb tyb .g.e 652-0 morf slamiced tuohtiw seulav ciremun evitisoP etyB nlb emiTrevOsInlb .g.e eslaF ro eurT .g.e .ylno seulav owt fo enO naelooB xiferP egnaR dna noitpircseD epytataD gnirtS sA emanruSrts miD ,ycnerruC sA tsoCruc miD .g.e epytataD sA emaNraV miD :tnemetats MID eht fo tamrof eht si ereH .)noisnemid rof sdnats MID erehw( selbairav eralced ot tnemetats MID a esu uoY .deralced eb tsum ti elbairav a esu nac uoy erofeb tub deen uoy sa selbairav ynam sa evah nac margorp A .epytatad eno dloh ylno nac elbairav A .atad sdloh taht noitacol deman a si elbairav A BV ni sepyt ataD rabllorcs lacitrev bsv xob txet txt remit rmt epahs phs xob erutcip cip nottub noitpo tpo tneilc ELO elo unem unm xob tsil tsl enil nil lebal lbl egami gmi rabllorcs latnoziroh bsh dirg drg mrof mrf emarf arf xob tsil elif lif xob tsil elif lif xob tsil evird vrd xob tsil yrotcerid rid nottub dnammoc dmc xob kcehc khc xob obmoc obc lortnoC xiferP lortnoC xiferP seman lortnoC rof snoitaiverbbA xiferP eltiTlbl .ge .eman lufgninaem a yb dewollof ,lortnoc fo epyt eht yfitnedi ot srettel esaCrewol eerht fo xiferp a esu snoitnevnoc gnimaN .niatniam ro daer ot redrah edoc eht sekam ti sa ecitcarp doog ton si siht ,tcejorp gib a nI .cte ,1lebaL ,1txeT ,seman tluafed detpecca netfo evah ew ,won llit pU snoitnevnoc gnimaN .pukcab dna evaS .tcejorp ruoy tset ot yek noitcnuf >5F< esU .5 .edoc etairporppa eht dda ot unem ruoy ni 2 elpmaxe kcilc elbuod dna mrof niam ruoy ot nruter ot wodniw rerolpxE tcejorP eht esU .4
  • 6. .epyt ot trats uoy sa tsil nwod pord a seilppus tpmorp pleh eht sa meht nrael ot evah t’nod uoY .)egnahc t’nod taht seulav( slaretil ydnah emos era ereH .krow ruoy evas ot tegrof t’noD .>5F< gnisu margorp ruoy nuR • End Sub Form1.Show Private Sub cmdBack_Click() edoc eht gnisu ,regnahCruoloC eht ni did uoy sa kcaBdmc dellac ,nottub nruter a ddA • End Sub intAnswer = MsgBox(“Hello there” & strQuestion, vbOKCancel, “Chat”) strQuestion = InputBox(“Type in your name!”, “Ebeneezer”) ‘Then use the input and message box functions’ Dim intAnswer As Integer ‘First you must declare your variables’ Dim strQuestion As String Private Sub cmdTalk_Click() .ecneuqes edoc gniwollof eht dda ot nottub dnammoc eht kcilc elbuoD • .klaTdmc nottub dnammoc eht emaN ”!em ot klaT“ noitpac eht htiw nottub dnammoc a evah htaenrednU .”noitasrevnoC retupmoC“ mrof eht fo pot eht no lebal a tuP • ”sexoB tupnI dna egasseM“ = noitpaC.mroF eht ekaM • ”sexoB tupnI dna egasseM“ siht llaC .mrof niam eht no gnidaeh unem a htiw mrof wen a etaerc ot 1 ytivitcA fo dne eht ta unem ot mrof wen ddA snoitcurtsni eht wolloF .margorp eht htiw tcaretni ot resu dne eht wolla hcihw 0.6 cisaB lausiV ni snoitcnuf cisnirtni era sexob tupni dna egasseM sexob tupni dna egasseM :3 ytivitcA .sexob tupni dna sexob egassem edulcni snoitcnuf cisnirtni owT .deriuqer era sisehtnerap eht ,stnemugra on sah noitcnuf a fi nevE .stnemugra noitcnuf eht dloh ot dne eht ta sesehtnerap evah seman noitcnuF .htiw krow ot atad sah noitcnuf eht os noitcnuf a ot ssap uoy eulav a si tnemugra nA .srettel esaCrewol ro esaCreppu ot txet gnitrevnoc sa hcus atad gnirts etalupinam srehtO .sksat lacitamehtam cisab mrofrep emoS .)snoitcnuf cisnirtni( snoitcnuf ni-tliub ynam sedulcni cisaB lausiV .tluser elgnis a snruter dna stnemugra erom ro eno ,orez stpecca taht edoc fo tnemges a si noitcnuf A rav eulaVlortnoCtnv .g.e .nwonknu si epytatad eht hcihw ro tnv rof seulav rehto dna lortnoc rof desu epytatad yna fo ataD tnairaV emaNtsriFrts .g.e ½ ,^ ,@ sa hcus sretcarahc laiceps gnidulcni atad rts ciremunahpla fo sretcarahc 004,56 ot 0 fo stsisnoc taht ataD gnirtS serugiFselaSraeYgns .noisicerp-elgnis dellac netfO .83+E328204,3 gns ot 83+E328204,3– morf egnar taht seulav ciremuN elgniS pilCdnuoSjbo .g.e .smrof ro slortnoc jbo sa hcus stcejbo secnerefer dna sdloh taht epytatad laiceps A tcejbO ecnatsiDratSgnl .g.e 746,384,741,2 ot 846,384,741,2–
  • 7. End If Else … IntError = MsgBox (“You cannot divide by 0!”, VbOkCancel, “Whoops!) If Val (txtTwo.Text) = 0 Then .resu eht ot melborp eht etacidni ot noitcnuf )(xoBgsM eht esU .orez gniretne yb ro gnihton gniretne yb rehtie ,orez yb edivid ot elbissop ton si ti taht erusnE .resu eht rof noitpo na eb thgim siht ,revelc yrev era uoy fI lblAnswer.Caption = Format (dblAnswer, “#,##0.00”) .secalp lamiced owt ot ffo dednuor si rewsna erusne ot noitcnuf tamroF a esU .rebmun dnoces rof taepeR Val (txtOne.text) dblNo1 = .elbairav eht otni eulav taht tup ot tnemetats tnemngissa na neht ,rebmun a ot xob tupni morf gnirts egnahc ot noitcnuf laV esU intError As Integer dblAnswer As Double dblNo2 As Double dblNo1 As Double :selbairav eralceD .)rewsnAlbl( rewsna eht yalpsid ot lebal a dna )owTtxt dna enOtxt( sexob tupni owt esu thgim noitulos elbissop A[ .resu eht yb nevig srebmun owt edivid dna ylpitlum ,tcartbus ,dda nac taht rotaluclac a etaerC 4 ytivitcA .yletelpmoc derongi si edoc fo enil taht ,kramer eht fo tnorf ni decalp si ‘ ro meR fI .ecnanetniam edoc rof noitamrofni dda ot ro edoc fo noitces a fo esoprup eht nialpxe ot edoc ni dedda era skrameR .esle gnihtyna gniod erofeb xob siht egdelwonkca tsum resu ehT .xob golaid ladoM metsyS a syalpsiD 6904 ladoMmetsySbv .noci egassem noitamrofnI syalpsiD 46 noitamrofnIbv .noci egasseM gninraW syalpsiD 84 noitamalcxEbv .noci yreuQ gninraW syalpsiD 23 noitseuQbv noci egasseM lacitirC syalpsiD 61 lacitirCbv noitpircseD eulaV laretil demaN sexoB egasseM ni snocI .snottub lecnaC dna yrteR eht syalpsiD 5 lecnaCyrteRbv .snottub oN dna seY eht syalpsiD 4 oNseYbv .snottub lecnaC dna oN ,seY eht syalpsiD 3 lecnaCoNseYbv .snottub erongI dna yrteR ,trobA eht syalpsiD 2 erongIyrteRtrobAbv snottub lecnaC dna nottub KO eht syalpsiD 1 lecnaCKObv nottub KO eht syalpsiD 0 ylnOKObv noitpircseD eulaV laretiL demaN sexoB egasseM ni snottuB
  • 8. ).orez yb gnidivid resu a tneverp ot rotaluclac ruoy ni noitceles yranib desu evah uoY( fI dnE stnemetatS cisaB lausiV erom ro enO eslE stnemetats cisaB lausiV erom ro enO nehT tset nosirapmoc fI RO fI dnE stnemetats cisaB lausiV erom ro enO nehT tset nosirapmoc fI .cisaB lausiV ni xatnys eht si ereH .stnemetats If – Else – End If eht ro If – End If eht sesu noitceles yraniB )seciohc elpitlum( yawitluM ro )yaw owt( yraniB eb nac stcurtsnoc noitceleS .edam eb ot seciohc rof swolla dna tneve yna rof syawhtap elpitlum swolla noitceleS .noitceles — tcurtsnoc mhtirogla dnoces eht sesu etirw lliw uoy smargorp fo puorg txen ehT noitceles yraniB `output End Sub txtOne.SetFocus lblAnswer.Caption = “” txtTwo.Text = “” `sequence of processes initializing variables txtOne.Text = “” `user input Private Sub cmdClear_Click() .g.e ,spets ssecorp fo seires a dna tuptuo ,tupni fo tsisnoc dluow mhtirogla eht ,erudecorp bus hcae rof ,oS .tneve hcae rof yawhtap elbissop eno ylno htiw rehtona dewollof edoc fo enil hcaE .stcurtsnoc mhtirogla ecneuqes morf detcurtsnoc lla erew 3 — 1 seitivitcA ni smargorp ehT smhtirogla ecneuqeS .mrof niam eht no gnidaeh unem noitceleS yraniB a ot tcennoC .etad eht dna eman ruoy sedulcni hcihw edoc ruoy fo pot eht ta )enil eht fo gninnigeb eht ta ‘ tup( kramer a ddA .tif ot hcterts lliw ti eurt ot ytreporp ezisotua s’lebal eht tes uoy fI ?seulav lla rof hguone gib lebal ruoy sI .cte ,sorez ,srebmun evitagen ,srebmun llams yrev ,srebmun gib yrev ,sregetni esU .skrow ti taht kcehC .pu ti ytterp ot seitreporp teS .xob tupni tsrif eht ot rosruc eht snruter dohtem sucoFteS ehT txtOne.SetFocus lblAnswer.Caption = “” txtTwo.Text = “” txtOne.Text = “” .noitaluclac rehtona od ot resu eht wolla ot edoc gniwollof eht htiw nottub dnammoc raelc a ddA
  • 9. egAtni esaC tceleS :elpmaxe roF tceleS dnE ]stnemetats BV erom ro enO[ eslE esaC ]stnemetats BV erom ro enO[ eulav esaC ]stnemetats BV erom ro enO[ eulav esaC ]stnemetats BV erom ro enO[ eulav esaC noisserpxE esaC tceleS .stnemetats esaC hguorht noitceles elpitlum rof xatnys eht si ereH .stnemetats esaC esu ot retteb si tI .edoc daer-ot-drah ot sdael dna detacilpmoc semoceb siht tub stnemetats fI detsen esu nac uoy ,sevitanretla owt naht erom sevlovni noitceles eht fI .noitceles yranib fo elpmaxe na ta dekool ew 5 ytivitcA nI noitceles yawitluM .456789000000.0 ,srebmun evitagen ,orez ,srebmun llams yrev ,srebmun egral yrev gnidulcni atad tset emos htiw tuo ti yrT .stluser eht yfirev ot rotaluclac ruoy esU • .yltcerroc gnikrow si ti taht erusne ot noitacilppa eht nuR • .noitceleS yraniB gnidaeh unem ot tcennoC • .emit a ta detceles eb nac eno ylno .e.i ,evisulcxe yllautum era snottub noitpO .detceles si nottub noitpo hcihw no desab esu ot alumrof hcihw enimreted ot stnemetats FI esU • .sehcni ot sertemitnec ro sertemitnec ot sehcni si noisrevnoc eht rehtehw etacidni ot resu eht rof )xobloot eht morf( snottub noitpo esU • .)sertemitnec 45.2 = hcni 1 noisrevnoc eht gnisu( sehcni ot sertemitnec RO sertemitnec ot sehcni trevnoc ot margorp a etirW • .noitceleS yawitluM dna noitceleS yraniB ,sgnidaehbus owt htiw snoitceleS gnidaeh unem wen a ddA • .smc 45.2 si sertemitnec ni tnemerusaem ehT !ti trevnoC tnemerusaem eht retnE 1 sertemitneC ro sehcnI ni tnemerusaem ruoy sI 5 ytivitcA
  • 10. Label1.Caption = "Thursday" Case Index = 3 Label1.Caption = "Wednesday" Case Index = 2 Label1.Caption = "Tuesday" Case Index = 1 Case Index = 0 Label1.Caption = "Monday" Select Case optChoice (Index) Private Sub optChoice_Click (Index As Integer) :siht ekil kool thgim erudecorp tneve kcilC eht ,eciohCtpo dellac snottub noitpo fo yarra lortnoc a detaerc uoy fi ,oS .seulav ytreporp xednI tnereffid gnivah yb dehsiugnitsid era yarra eht nihtiw slortnoc laudividnI .mrof ruoy ot sexob kcehc ro snottub oidar gnidda ni ydaerla siht deretnuocne evah yam uoY .)dnammoc etsaP dna ypoC eht gnisu yb detaerc netfo( eman emas eht htiw epyt emas eht fo slortnoc elpitlum fo tes a si yarra lortnoc A 7 ytivitcA .gnidaeh unem yawitluM eht ot detcennoc niaga sleveLesioN eman eht rednu unem mrof niam eht ot siht knil dna stnemetats esaC esu niagA gnixaleR 92 – 0 gnitcartsiD 95 – 03 gnibrutsiD 98 – 06 gninefaeD 931 – 09 lufniap ylemertxE +041 level trofmoC level lebiceD .elbat gniwollof eht ni noitamrofni no desab level lebiced elbaborp eht tuptuo neht ,stnemmoc eht yb level esion eht esoohc ot resu a wolla ot sexob kcehc fo tes a esU .2 .mrof niam ruoy ni gnidaeh unem yawitluM eht rednu sthgieWesaC sa siht kniL .edoc ruoy ni stnemetats esaC esU .egatsop eht etaluclac dna xob txet a ni thgiew eht retne ot resu a swolla taht tcejorp a ngiseD 20.0*thgiew yb detaluclac era smg 005 naht reivaeh era hcihw slecraP 05.7$ 005 – 152 00.4$ 052 – 101 07.2$ 001 – 15 04.1$ 05 – 0 tsoC )marg( thgieW .sthgiew tnereffid nopu desab slecrap rof segrahc gniwollof eht sah eciffo tsop ehT .1 6 ytivitcA tceleS dnE ”tludA“ = noitpaC.eltiTlbl eslE esaC ”loohcS yradnoceS“ = noitpaC.eltiTlbl 81 oT 21 esaC ”loohcS yramirP“ = noitpaC.eltiTlbl 11 oT 6 esaC ”loohcserP“ = noitpaC.eltiTlbl 6 < sI esaC
  • 11. .repeeBmrf mrof ruoy emaN .speeb fo rebmun taht eussi ot pooL …… elihW oD esu ,dilav si rebmun eht fI .egnar detcepxe eht edisni t’nsi rebmun eht fi egassem rorre na eussi dna rebmun dilav a rof xobtxet eht kcehc ,nottub dnammoc eht skcilc resu eht nehW .01 dna 1 neewteb rebmun a tupni ot resu eht gniksa xob txet eht evoba lebal a tuP .nottub dnammoc a dna xob txet a ddA .unem niaM eht no )speeb eht tnuoC -( tset-erp — noitareti ot knil dna mrof wen a etaerC 8 ytivitcA .ecno tsael ta snur syawla edoc eht taht os pool eht fo dne eht ta si tem eb ot noitidnoc eht ,spool eseht ni :snoitareti tset-tsoP • .tem reven si noitidnoc eht fi lla ta nur ton lliw edoc eht dna pool eht fo gninnigeb eht ta srucco tem eb ot noitidnoc eht ,spool eseht ni :snoitareti tset-erP • :serutcurts noitareti cisab 2 era erehT .gnipool eht gnippots fo yaw a niatnoc TSUM noitareti hcaE .)semit fo rebmun detnuoc a rof ro( eurt sniamer noitidnoc emos elihw yldetaeper tuo deirrac eb ot stnemetats fo puorg ro tnemetats a wolla taht serutcurts era spool ro snoitaretI snoitaretI noitaretI 7 ytivitcA morf )syad ym ruoloC-( yawitluM 6 ytivitcA morf )slevel esioN -( yawitluM 6 ytivitcA morf )sthgiew lecraP -( yawitluM 5 ytivitcA morf )retrevnoC tnemerusaeM -( yraniB 4 ytivitcA morf )rotaluclac ehT -( yraniB noitceleS 3 ytivitcA morf )noitasrevnoC retupmoC –( ecneuqeS sexob tupnI dna egasseM 2 ytivitcA morf )regnahc ruoloC –( 2 elpmaxE 1 ytivitcA morf )BV ot emocleW –( 1 elpmaxE )secneuqeS( noitcudortnI tiuQ uneM .degnahc eb ot deen taht yna egnahc dna woleb tsil eht kcehC .smrof tcerroc eht ot )edoc yb( deknil dna tcerroc lla era niaM no sgnidaeh unem eht taht kcehc — snoitareti — serutcurts tsal eht htiw eunitnoc ew erofeB .syaD yM ruoloC gnidaeh eht rednu unem mrof niam eht ni gnidaeh noitceleS yawitluM unem eht ot kniL .yad tnereffid hcae rof )etairporppa gnihtemos ot( ruoloc dnuorgkcab lebal eht egnahc ot edoc dda neht ,tuo siht yrT .detceles saw nottub noitpo tnereffid hcae sa noitpac lebal eht egnahc dluow evoba edoc ehT End Sub End Select Label1.Caption = "Sunday" Case Else Label1.Caption = "Saturday" Case Index = 5 Label1.Caption = "Friday" Case Index = 4
  • 12. .trahcwolf a sa mhtirogla siht etirW MARGORPNIAM DNE egareva yalpsid retnuoc / mus = egareva 01 = retnuoc LITNU 1 + retnuoc = retnuoc rebmun + mus = mus rebmun teg TAEPER 0 = mus 0 = retnuoc margorP niaM NIGEB egareva O retnuoc/mus = egareva retnuoc ot 1 dda mus ot rebmun dda P retnuoc ,rebmun I :siht ekil kool thgim ,pool tset-tsop a gnisu ,draobyek eht morf deretne srebmun emos fo egareva eht gnidnif rof mhtirogla edocoduesp dna trahc OPI ehT noitareti tset-tsop • noitareti tset-erp • noitceles yawitlum • noitceles yranib • ecneuqes • .serutcurts lortnoc cisab 5 eht gniniatnoc edoc gnitirw ta kool ew ,lairotut siht nI 9 ytivitcA .margorp siht rof mhtirogla edocoduesp eht etirw nehT .margorp siht rof trahC OPI na etirW End Sub End If Text1.SetFocus Text1.Text = "" Else Loop ‘Count down intNumber = intNumber - 1 Next pause frmBeeper.Refresh ‘Slow down the beeps For pause = 0 To 2500 Beep Do While intNumber > 0 ‘Validate number If (intNumber > 0) And (intNumber < 11) Then ‘Input user number intNumber = Val(Text1.Text) Dim pause As Integer ‘Declare variables Dim intNumber As Integer Private Sub Command1_Click()
  • 13. .modnar osla si srebmun modnar fo ecneuqes hcae fo trats eht taht serusne tnemetats ezimodnaR ehT x = Int (Rnd*100 + 51) .051 ot 15 morf egnar eht ni sregetni modnar secudorp tnemetats gniwollof ehT x = Int(Rnd * N) xatnys gniwollof eht esu ,N < x =< 0 erehw x regetni modnar a ecudorp oT .ecid eht lloR … spooL tset tsoP … snoitaretI rednu )niaM( mrof unem eht morf margorp eht ot knil a etaerC .)lluf si xob erutcip eht litnu( semit lareves nottub dnammoc eht gnikcilc margorp ruoy nuR End Sub Loop Until x <> 6 Picture1 Print x; x = Int(Rnd * 6 + 1) Do ‘ Ensures the start of each sequence of random numbers is also randomised Randomize Picture1 Print x = 0 Dim x As Integer Private Sub Command1_Click() .ti dniheb edoc gniwollof eht htiw nottub dnammoc a dna eurt ot tes ytreporp ezisotuA eht htiw xob erutcip egral a deen lliw mrof ruoY .ecid a fo gnillor eht etalumis ot 6 dna 1 neewteb rebmun modnar a etareneg ot mrof wen a no noitacilppa na etirW .rebmun modnar a etareneg ot )(dnR noitcnuf wen a esU 01 ytivitcA .rewsna ruoy nialpxE ?margorp ruoy hsarc dna orez yb noisivid esuac reven lliw retnuoc eht taht erus eb uoy naC intCounter = 0 intNumber = 0 .erudecorp eht fo gninnigeb eht ta 0 ot selbairav ruoy esilaitinI Dim strNumber As String .g.e .stnemetats miD htiw selbairav ruoy lla eralced ot tegrof t’noD intNumber = Val(strNumber) strNumber = InputBox(“Enter the next number.”, “Enter your numbers.”) :xatnys eht gnisu xob tupni na htiw rof deksa eb thgim rebmun hcaE .srebmun ot sgnirts trevnoc ot noitcnufVal () eht esu ot rebmemeR .rebmun hcae rof ksa ot Until Do …..Loop xatnys eht htiw pool tset-tsop a gnisu resu eht yb deretne srebmun 01 fo egareva eht yalpsid ot noitacilppa na etirW .segarevA … spooL tset-tsoP … snoitaretI rednu )niaM( mrof unem eht morf margorp eht ot knil a etaerc dna mrof wen a nepO
  • 14. regetnI sA ]21,21[selbaTrra miD :tnemetats eht deen uoy ,elbairav ruoy eralced oT .meht gnikcehc dna smhtirogla ruoy gnitirw ,tsrif repap no tuo eno siht tolp ot deen yletinifed lliw uoY .yalpsid eht no elbat semit wen hcae rof enil wen a htiw ]... ]elbairav[ ,elbairav( tnirP yalpsiDcip :xatnys eht gnisu lortnoc erutcip a otni 21 – 1 morf selbat semit eht tuo tnirp ot neht dna yarra lanoisnemid 2 a llif ot spool roF detsen sesu taht margorp a etirW 21 ytivitcA .trahcwolf a sa dna edocoduesp ni mhtirogla eht dna trahc OPI na etirW Loop End If ‘This creates a new line Picture1 Print If Counter = 10 Then Counter = Counter + 2 FibNext = FibNext + FibNumber FibNumber = FibNumber + FibNext Picture1 Print FibNext & ", " ‘trailing semicolon stops the Print method going to the next line. Picture1 Print FibNumber & ", "; Do While Counter < 20 Picture1 Print "Ist 20 Fibonacci Numbers" FibNext = 1 FibNumber = 0 ‘Initialise Dim FibNumber As Integer, FibNext As Integer, Counter As Integer .uoy pleh ot edoc gniwollof eht esU .roloCeroF eht morf tnereffid si roloCkcaB eht taht dna eurT = wardeRotuA ,eslaF = tnerapsnarT tnoF.xoBerutciP eht erus ekaM .ot stluser ruoy tnirp ot xoB erutciP a ddA .snoitareti fo rebmun eht lortnoc ot retnuoc a esu emit sihT .srebmun iccanobiF 02 tsrif eht etareneg ot margorp a etaerC 11 ytivitcA .seod margorp eht ni enil yreve tahw snialpxe taht edocoduesp ni noitacilppa siht rof mhtirogla eht etirW LITNU .…… TAEPER xatnys edocoduesp eht ot tnelaviuqe htob era esehT .ecno tsael ta etucexe tsum pool eht ni edoc eht taht gninaem pool eht fo mottob eht ta sraeppa tset nosirapmoc eht erehw spool tset-tsop era htoB Do ……. Loop While (comparison test) • Do ……. Loop Until (comparison test) • :snoitareti tset-tsop rof stnemetats xatnys tnereffid owt sah cisaB lausiV taht eciton lliw uoY
  • 15. drofpmaS yelreveB yb deraperp saw krow sihT mth.golatac/ten.de-eerf.www//:ptth :golataC esruoC teN dE-eerF /moc.bvhcraes.www//:ptth :moc.tegraThceT yb detneserp enignE hcraeS dna latroP cificepS BV ehT ,moc.BVhcraes .yelseW-nosiddA :sttesuhcassaM ,gnidaeR .0.6 cisaB lausiV ni snoitacilppa htiw slatnemadnuf gnimmargorp retupmoC .)0002( .R ,nworB dna .M ,namreK secruoseR rehtruF noitamrofnyL :DLQ ,dleifsnaM .cisaB lausiV ot noitcudortni nA .)9991( I ,hcnyL yhpargoilbiB