Beruflich Dokumente
Kultur Dokumente
Visual Basic Tutorial
Visual Basic Tutorial
.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
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 srennigeb a sniatnoc lairotut sihT
: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
.depyt era eman dna noitpac unem hcae retfa KO kcilC fo sgnidaehbus detnedni htiw noitcudortnI
2elpmaxE 1elpmaxE
tiuQ
.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
: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
.srorre fo eerf si ti taht erusne ot >5F< nur dna krow ruoy evaS
Private Sub Example1_Click() Welcome.Show End Sub
siht od oT .neercs emoclew a etaerc ot nottub dnammoc a dna egami na ,slebal owt ddA
Unload me End
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
.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
.KROW RUOY LLA )YPPOLF OT PU KCAB DNA( EVAS OT TEGROF TNOD .noitacilppa eht nur ot >5F< esu dna krow ruoy evas ot unem elif eht esU .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 Welcome
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
.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
FormXX.Show
tneve )(kcilCno_ sti ot edoc gniwollof eht dda dna nottub nruter eht kcilc elbuoD .3
Label2.BackColor = RGB(HScroll1.Value, 0, 0) Label3.BackColor = RGB(0, HScroll2.Value, 0) Label4.BackColor = RGB)0, 0, 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
Label1.ForeColor = RGB(255 - HScroll1.Value, 255 - HScroll2.Value, 255 HScroll3.Value) Label5.ForeColor = RGB(255 - HScroll1.Value, 255 - HScroll2.Value, 255 HScroll3.Value)
Unload Me
2 ytivitcA
xiferP
gnl morf epytatad regetnI fo egnar eht dnoyeb seulav regetnI tnuoCtni .g.e 767,23 ot 867,23 tni morf noitcarf ro tniop lamiced on htiw seulav ciremuN tnemerusaeMorciMlbd .g.e .noisicerp-elbuod dellac netfO .803+E23268431396797.1+ lbd ot 803+E23268431396797.1 morf seulav ciremuN nosseLtsriFetd etd .g.e 9999 ,13 ceD ot 001 ,1 naJ morf seulav emit dna etaD yaPylruoHruc .g.e 7085.774,586,302,733,229$ -+ ot 8085.774,586,302,733,229$morf stnuoma rallod sdloh taht ataD ruc egAtyb tyb .g.e 652-0 morf slamiced tuohtiw seulav ciremun evitisoP nlb emiTrevOsInlb .g.e eslaF ro eurT .g.e .ylno seulav owt fo enO
BV ni sepyt ataD
xob txet epahs nottub noitpo unem enil egami dirg emarf xob tsil elif xob tsil yrotcerid xob kcehc txt phs tpo unm nil gmi drg arf lif rid khc rabllorcs lacitrev remit xob erutcip tneilc ELO xob tsil lebal rabllorcs latnoziroh mrof xob tsil elif xob tsil evird nottub dnammoc xob obmoc bsv rmt cip elo tsl lbl bsh mrf lif vrd dmc obc
lortnoC
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 tnod uoY .)egnahc tnod taht seulav( slaretil ydnah emos era ereH
.krow ruoy evas ot tegrof tnoD .>5F< gnisu margorp ruoy nuR
Private Sub cmdBack_Click() Form1.Show End Sub
edoc eht gnisu ,regnahCruoloC eht ni did uoy sa kcaBdmc dellac ,nottub nruter a ddA
End Sub
.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
strQuestion = InputBox(Type in your name!, Ebeneezer) intAnswer = MsgBox(Hello there & strQuestion, vbOKCancel, Chat) Then use the input and message box functions First you must declare your variables
.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 .secalp lamiced owt ot ffo dednuor si rewsna erusne ot noitcnuf tamroF a esU .rebmun dnoces rof taepeR .elbairav eht otni eulav taht tup ot tnemetats tnemngissa na neht ,rebmun a ot xob tupni morf gnirts egnahc ot noitcnuf laV esU
dblNo1 As Double dblNo2 As Double dblAnswer As Double intError As Integer dblNo1 = Val (txtOne.text) lblAnswer.Caption = Format (dblAnswer, #,##0.00)
: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
.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 .noci egassem noitamrofnI syalpsiD .noci egasseM gninraW syalpsiD .noci yreuQ gninraW syalpsiD noci egasseM lacitirC syalpsiD 6904 46 84 23 61 ladoMmetsySbv noitamrofnIbv noitamalcxEbv noitseuQbv lacitirCbv
noitpircseD
.snottub lecnaC dna yrteR eht syalpsiD .snottub oN dna seY eht syalpsiD .snottub lecnaC dna oN ,seY eht syalpsiD .snottub erongI dna yrteR ,trobA eht syalpsiD snottub lecnaC dna nottub KO eht syalpsiD nottub KO eht syalpsiD
noitpircseD
End If If Val (txtTwo.Text) = 0 Then IntError = MsgBox (You cannot divide by 0!, VbOkCancel, Whoops!) Else
4 ytivitcA
).orez yb gnidivid resu a tneverp ot rotaluclac ruoy ni noitceles yranib desu evah uoY( stnemetatS cisaB lausiV erom ro enO
fI dnE eslE
fI dnE
ereH .stnemetats
eht ro
)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 `user input `sequence of processes initializing variables Private Sub cmdClear_Click() txtOne.Text = txtTwo.Text = lblAnswer.Caption = txtOne.SetFocus End Sub
.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 slebal 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.Text = txtTwo.Text = lblAnswer.Caption = txtOne.SetFocus
.noitaluclac rehtona od ot resu eht wolla ot edoc gniwollof eht htiw nottub dnammoc raelc a ddA
tceleS dnE
]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
eslE esaC
noitceles yawitluM
sertemitneC ro
5 ytivitcA
.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
: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
.gnidaeh unem yawitluM eht ot detcennoc niaga sleveLesioN eman eht rednu unem mrof niam eht ot siht knil dna stnemetats esaC esu niagA gnixaleR gnitcartsiD gnibrutsiD gninefaeD lufniap ylemertxE 92 0 95 03 98 06 931 09 +041
.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$ 00.4$ 07.2$ 04.1$ 005 152 052 101 001 15 05 0
.sthgiew tnereffid nopu desab slecrap rof segrahc gniwollof eht sah eciffo tsop ehT .1
Private Sub optChoice_Click (Index As Integer) Select Case optChoice (Index) Case Index = 0 Label1.Caption = "Monday"
level trofmoC
tsoC
)marg( thgieW
tludA = noitpaC.eltiTlbl
loohcS yradnoceS = noitpaC.eltiTlbl 81 oT 21 esaC loohcS yramirP = noitpaC.eltiTlbl 11 oT 6 esaC loohcserP = noitpaC.eltiTlbl 6 < sI esaC
7 ytivitcA
level lebiceD
eslE esaC
.repeeBmrf mrof ruoy emaN .speeb fo rebmun taht eussi ot pooL elihW oD esu ,dilav si rebmun eht fI .egnar detcepxe eht edisni tnsi 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
7 ytivitcA morf 6 ytivitcA morf 6 ytivitcA morf 5 ytivitcA morf 4 ytivitcA morf 3 ytivitcA morf 2 ytivitcA morf 1 ytivitcA morf
noitaretI )syad ym ruoloC-( yawitluM )slevel esioN -( yawitluM )sthgiew lecraP -( yawitluM )retrevnoC tnemerusaeM -( yraniB )rotaluclac ehT -( yraniB noitceleS )noitasrevnoC retupmoC ( ecneuqeS sexob tupnI dna egasseM )regnahc ruoloC ( 2 elpmaxE )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 Select End Sub
.trahcwolf a sa mhtirogla siht etirW MARGORPNIAM DNE egareva yalpsid retnuoc / mus = egareva 01 = retnuoc LITNU 1 + retnuoc = retnuoc rebmun + mus = mus rebmun teg 0 = mus 0 = retnuoc margorP niaM NIGEB egareva retnuoc/mus = egareva retnuoc ot 1 dda mus ot rebmun dda retnuoc ,rebmun O P I
TAEPER
: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
If (intNumber > 0) And (intNumber < 11) Then Do While intNumber > 0 Beep For pause = 0 To 2500 frmBeeper.Refresh Next pause intNumber = intNumber - 1 Loop Else Text1.Text = "" Text1.SetFocus End If End Sub Private Sub Command1_Click() Dim intNumber As Integer Dim pause As Integer intNumber = Val(Text1.Text)
Validate number
Declare variables
Count down
.modnar osla si srebmun modnar fo ecneuqes hcae fo trats eht taht serusne tnemetats ezimodnaR ehT .051 ot 15 morf egnar eht ni sregetni modnar secudorp tnemetats gniwollof ehT 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
x = Int(Rnd * 6 + 1) Picture1 Print x; Loop Until x <> 6 End Sub x = Int(Rnd * N) x = Int (Rnd*100 + 51)
.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
.rewsna ruoy nialpxE ?margorp ruoy hsarc dna orez yb noisivid esuac reven lliw retnuoc eht taht erus eb uoy naC .erudecorp eht fo gninnigeb eht ta 0 ot selbairav ruoy esilaitinI .g.e .stnemetats miD htiw selbairav ruoy lla eralced ot tegrof tnoD
strNumber = InputBox(Enter the next number., Enter your numbers.) intNumber = Val(strNumber) Dim strNumber As String intNumber = 0 intCounter = 0
:xatnys eht gnisu xob tupni na htiw rof deksa eb thgim rebmun hcaE .srebmun ot sgnirts trevnoc ot noitcnuf eht esu ot rebmemeR .rebmun hcae rof ksa ot 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
Val () Do ..Loop
Until
01 ytivitcA
Do Randomize Ensures the start of each sequence of random numbers is also randomised Picture1 Print
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
Do While Counter < 20 Picture1 Print FibNumber & ", "; trailing semicolon stops the Print method going to the next line. Picture1 Print FibNext & ", " FibNumber = FibNumber + FibNext FibNext = FibNext + FibNumber Counter = Counter + 2 If Counter = 10 Then Picture1 Print This creates a new line End If Loop
.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
.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 :snoitareti tset-tsop rof stnemetats xatnys tnereffid owt sah cisaB lausiV taht eciton lliw uoY
Do . Loop Until (comparison test) Do . Loop While (comparison test)
Picture1 Print "Ist 20 Fibonacci Numbers" Initialise FibNumber = 0 FibNext = 1 Dim FibNumber As Integer, FibNext As Integer, Counter As Integer
11 ytivitcA
drofpmaS yelreveB
secruoseR rehtruF
noitamrofnyL :DLQ ,dleifsnaM .cisaB lausiV ot noitcudortni nA .)9991( I ,hcnyL
yhpargoilbiB