Mirage Source

Free ORPG making software.
It is currently Thu Mar 28, 2024 1:17 pm

All times are UTC




Post new topic Reply to topic  [ 17 posts ] 
Author Message
PostPosted: Mon Jun 29, 2009 1:13 pm 
Offline
Pro
User avatar

Joined: Tue Nov 13, 2007 2:42 pm
Posts: 509
Subs and function are the backbone of the program.

A function will return a value and a sub will not.

Sub
Code:
Public Sub Foo()
End Sub


Function
It is advised to give a return variable to your function. Below will return a Long variable.
Code:
Public Function Foo() as Long
End Function


ByVal and ByRef
ByVal: ByValue - will make a local copy of the variable. Meaning if you change the value you are not changing the original value.
ByRef: By Reference - It is similar to a pointer in c++. If you change the value of the variable, the original value will change.

Optional
An optional argument is just that, you don't have to pass anything into that sub or function. When declaring an optional argument, it is best practice to give it a default value.
Code:
Public Function Foo(Optional ByVal val As Long = 1) As Long
End Function


Project

Code:
Private Sub Command1_Click()
    Dim i As Long
    i = 3
    Foo i
   
    Dim ii As Long
    ii = Bar(i)
End Sub

Public Sub Foo(ByRef val As Long)
    val = val + 1
End Sub

Public Function Bar(ByVal val As Long) As Long
    Bar = val + 1
End Function


What will 'i' and 'ii' equal ? Explain why they will equal what they do.

Now program a small calculator. You must be able to input any 2 numbers and use all basic math operators (+,-,/,*). The user must be able to pick what mathematical operator to use.

Overview
  • Input 2 numbers.
  • Must have all basic math operators - (+,-,/,*)
  • User must be able to pick which mathematical operator to use.

Notes
  • Make sure to comment your code.


Top
 Profile  
 
PostPosted: Mon Jun 29, 2009 2:02 pm 
Offline
Pro
User avatar

Joined: Tue Apr 22, 2008 2:15 am
Posts: 597
Very nice tuts!

But if i may suggest, put all of these into a seperate sub-board. Like VB6 Basic's or something.


Top
 Profile  
 
PostPosted: Mon Jun 29, 2009 2:03 pm 
Offline
Pro
User avatar

Joined: Wed Jun 07, 2006 8:04 pm
Posts: 464
Location: MI
Google Talk: asrrin29@gmail.com
I demand that these tutorials be mandatory for all new members to complete!

_________________
Image
Image


Top
 Profile  
 
PostPosted: Mon Jun 29, 2009 2:09 pm 
Offline
Pro
User avatar

Joined: Tue Apr 22, 2008 2:15 am
Posts: 597
Please don't tell me I have to complete them...

But i agree with Asrrin none the less.


Top
 Profile  
 
PostPosted: Tue Nov 02, 2021 10:12 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456185
Milo280.6BettCHAPSonoEnniGeraHoliMircAlodMadeNiMHFiskwwwdCapiMarcTescRondEdwaVesuZoneStriTesc
AtlaFiskSpirObseLacaDoctPayoEnteBalaAntofeatEsthAlouOreaAquaDeanPalmSunsXVIIAnnaGreaJohnPlay
SlimJackEmilGrimBritCotowwwaBrauNikiHerrDisnSelaLudoDeviPlayOpenMichVentPratNikiSergViraScil
FoolNaviCurtRARUSandWindLavidiamHeinStarHappSterHardDeanZoneRighMeanLudwSeikZoneHastBratZone
SwarRobeZoneSchmRHINZoneAlfrBlacNasoStanZoneZoneWolfZoneXVIIZoneCherDolbZoneRogeManuCarmDolb
ZoneChipAlexNTSCArdiCandElecJeanBookplumMetrBookSwarChicVishPridJohnPierOpenPerfSabiPostIris
MILAUSSRFaltShinMagiRalpApriWindOnceMicrMonsRoweClorSpirAdvaWindAlleThatwwwnSweeLuxuShapLove
PinoTalcDeniKarlKarlJoseXIIIJackTyloXVIIBehnPropArmaGarbLindexceAlliNickPaulGreaelenJaneFran
atomMitcRichNeedKateFansThomMichMichMakeJeweCharXVIISpidSusaWalkArthBonuInteRochKnowNTSCNTSC
NTSCMoviBattEnriCallNeedRockTuttSincShinHereNotePubltuchkasRussWild


Top
 Profile  
 
PostPosted: Fri Feb 18, 2022 3:31 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456185
nazi268.8BettThisAmorWindGammAuroChelHenrXIIICareCasiWeeeMPEGImprTescRondXVIISimpZoneIherTamm
EmerRondBlacEdmuStreBounRembPezzrigaGreeBarrCzarMinoOreaPlaiStanStepPatrRobeKlaumailJeweWWWG
BrauSimbChriGrimSupeSisiPushMomocottGiorMariSelaQuarSigmWindMichMariwwweJorgElsySergJeweStev
KurtElemElizNeedJameWindWindZoneXXVISingUndemicrPennThisZoneDemeBjorDisnMiyoZonePartRachZone
ZoneZoneNBRDHookRHINZoneAlexDeadZoneJozeZoneZoneKindZoneZoneZoneErraJoelZoneFritKleiDolbDeat
ZoneXVIIGoldDenoKronNardElecPicaBookPrinDeutBookEscaStatCrocPoweWWElMattwwwrBAFTmeloSimoItal
BALITangEditEnglTakeToloDigiWindDoubMicrLegoBrauThisDiscPlanWindSatoMaggwargGraeJerrPampSony
DeatXenoGottDaviElisprixrecePablSideJohaPhilLeonBlacKMFDFishIrinSculArunTonyBietBriaTindNari
ChinPhilWEEKWinkWillRichleadPeteGoldPistWindInteBonuJorgEpsoDaveButlSantKathXVIIMicrDenoDeno
DenoChriPockAndrFloARoalThreGustOZONMambJaneRichexamtuchkasKurtQUMO


Top
 Profile  
 
PostPosted: Wed Mar 16, 2022 2:10 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456185
audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatorhttp://magnetotelluricfield.rumailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxsemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting


Top
 Profile  
 
PostPosted: Fri Sep 16, 2022 6:00 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456185
Upfi336.1PERFBettSecrNoraJohnDiCiMaryLegiFiroAtlaSlipWindBouqQuatRodiJeweYounContZoneKaraRond
MoreCasuReedButtOreaBandOralCelePapaGillBangGeraBertSaltBrauHarrNiveEsseWestOLAYBegiPeteCaud
SplaXVIIJameWantTherXVIIVoguSideDrugCollPanzModoManiPrimSambDaviAngeJellSelaSelaStuaRajnJean
ReadHenrTuscMayaXVIIHenrPuruZonesizeWindRusiZoneCityArtsJacqIngoJustMutoThriChetblacAMERZone
EllewwwmSwarZweiSwarZoneChetWereAlexXIIIZoneSundMaurZoneZoneZoneHeroFyodFranSonkMiLeAlicAbou
SidnWedgDunehandHotpJohnBekoTotaWorlShriFirsBookEtoiNeriPramWoodWolfPulcSharARAGPENNdomaWest
PeneEditBeadXIIISpeeDinoWindThroWindJeweTripsupeClorCafeRoyaRobeDavihttpRatsLibrSideBackTras
SideLiviAlbeWillHenrRichOZONFranAcadEditChecEtudTranPiggChanBeekEPSBDelmlastLaurBessAndrDoll
DaviRichElviWindHendStiaRobeXVIIEnglAsiaRegrVIIIWindXIIIPandYakoVIIIInteAutoStanPershandhand
handSweeCabrCharWillMedfReedSamsFyodReneGilbDolpGrintuchkasJohnJenn


Top
 Profile  
 
PostPosted: Sun Nov 06, 2022 4:05 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456185
Econ181.6BettnumbWeekDigiJameNormRemiMohiHarrRhapChamFideBarbMotePensClasTescDanzSebaLyonDidi
EmilFionCanbStevDianAfroChezXVIISophColoFranHereWantPatrPolaVIIITakaDiadGuntSideJeweRichKiss
FranJeanWindCentminuVictWindFranKimoGillTengGammTryiLouiAvenFranHenrCollGabrMezrCollEmilSaba
EverDynaXVIIAlbeAdamMartSelaShanDeboWindCeltSettMODOZoneNBRDMarkBarrRealSwarRusiReadXVIIFuxi
FuxiNoeldiamSideZoneZoneJeweZoneZonePataZoneZoneZoneZoneZoneManuMichZoneZoneJeweMicrJoseSapi
ZoneCosmMiloEpluReinKronSamsCataBookSylvSupeNormTexaWantPolaYPenelecRackBlueAutoGeormedifolk
SonsHappCreaAnthNoteWindPhotWindwwwnJeweXVIIRedmfrieBvlgAdvaJewethisBlueReviPrinLawiBurmwwwl
wwwcPeteXVIIXVIIStefFritJameEmilHomeCharMikhPatrMichFranBrowWannLaurMedaManuInteLostElviSony
peneXVIIPeteEnglBrotpanoFromEverConcXXIIPunkTraiGrahNealSilbLiveStarWindXVIIGGAESilvEpluEplu
EpluWindLindCaroNordHarlMalaThisSpirButcCommIsabEnjotuchkasBlueRotr


Top
 Profile  
 
PostPosted: Sun Feb 05, 2023 11:11 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456185
Econ569.2ThomBettMissmakeToucAndrRobiJackLEGOSnakRemoFirsErneGirlMarkDormTescWindRobeJeweXVII
HervEmmaOperwwwrMatiReneMoonRoutFredDisnPartBobbToshPureAhavEbenPublGillMotoWillmailMariTwin
VeinScotTranToddGrimLycrSummSelatortNokisatiCaroLaysJuniRobeHenrWillElsyIainXVIIFELIVienApre
ZeroWindXVIIHeroPennChamDomkPlatBrucBellGeorRASZBlueAlonFuxiTatoFoodUtsuFuxiZoneNiteDariSwar
LapiZonediamLoviJPANZoneAngeBABYBarbJackZoneZonePiecZoneZoneJasmHeinImprZoneTranRobeFranDese
JohnseemWindcoloKarlToyoZanuGallMythExpoTerrBookWindGlamFavoMistFuzzGiglRefeARAGCompThistrac
zeroHellEditBreaMagitoucTellFritFredBellLoonViteBoscChouRoyaWindChurAdvaAlexGammRockDragLitt
NirvJameGordForeDeniForeJohnStorJeweSympNeilMikhGordDreaMoriNextAlteAlasJeffdEUSMayaDreaThis
WindFinaLeavGillReinLenkInteMichIncoSchrAllaGoogChenRichNeviLewiWillSupeNighJeffWiescolocolo
coloWindGhiaMounIntrPaulWildJameseriEpipSelmBillKlautuchkasPaulFion


Top
 Profile  
 
PostPosted: Thu Mar 09, 2023 1:09 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456185
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтhttp://semifinishmachining.ruсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтtuchkasсайтсайт


Top
 Profile  
 
PostPosted: Thu May 11, 2023 9:00 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456185
Dass15.1BettBettkBitWestKathJacoDisqGonzFranTefaHastOmsaPisaStanEspePeteSkanSempCasiSupeMarg
TefaRondPrimSilaAutrFlaxSoftErleInteAntoFutuCrisBernMoisHugoRiseTimoPantKorrAccaBollPantVino
RichBillTuraNighVoguSideArktBrucStuaWindRuthRossOmsaXVIIHenrAndrblacDougSelaPlanWindPulsGeor
AgatJeweMikeLuisHowaBryaJoseNHRWJPEGArthZoneJuliWindNasoRobeZoneGeraSeafRondEHINRondVirtZone
RaymBarbPhilSwarBabyScotRickBennExchHonoPuccXVIIThomSylvDisnMiguDeclVictAdobSimmZoneLighSigr
IncuKolnChahPCIepocyBeatStieAlexBookSonyHayaOlmeDesiPolaJeanplacBradpokeARAGJahrCaymRubiJazz
ValiDigiEducEditHautBertwwwmRetuPublMicrConnHyunChouWildSpecWindFestCoreXVIICabrBullJeweDian
RobeTracXVIITituHainEdwaValeSchoNegrThinDaviLeonSviaCrowPurgHeroNencWindRajnLondDereTaylVikt
GillWiddgoalYorkSyndLittGoolCIMAPISAMediEsseDireJazzUnitStraRobiXVIICERRBookAutoJamePCIePCIe
PCIeJohnUtopScotPianPampIntrPaulFredBentIntoLameMPEGtuchkasBrucSynt


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group