Mirage Source

Free ORPG making software.
It is currently Tue Sep 28, 2021 2:49 pm

All times are UTC




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

Joined: Tue Nov 13, 2007 2:42 pm
Posts: 509
I'm gonna post some basic tutorials / guides for the new users. If you see any errors or if you have any ideas please let me know.

Basics 1 - Variables.

Byte
8-bit: Values from 0 to 255. Whole numbers only.

Integer
16-bit: Values from -32768 to 32767. Whole numbers only. Takes 2 bytes in memory.

Long
32-bit: Values from -2,147,483,648 to 2,147,483,647. Whole numbers only. Takes 4 bytes in memory. (This is 'int' in c++ and c#)

Single
32-bit: Values from -3.402823e38 to -1.401298e-45 for negative values. Values from 1.401298e-45 to 3.402823e38 for positive values. Takes 4 bytes in memory.

Double
64-bit Values from -1.79769313486232e308 to -4.94065645841247e-324 for negative values. Values from 4.94065645841247e-324 to 1.79769313486232e308 for positive values. Takes 8 bytes in memory.

String
The String data type is usually used as a variable-length type of variable. A variable-length string can contain up to approximately 2 billion characters. Each character has a value ranging from 0 to 255 based on the ASCII character set. Strings are used when Text is involved.


In VB6, you declare variable in the following manner:
Code:
Dim [name of variable] as [Data Type]

Example - declaring 'b' as a byte:
Code:
Dim b as Byte


Project
Our first project will be a basic form application that will add 2 values together. The data types can be whatever you want. Display the output.

Overview
  • Declare variables.
  • Add 2 values together and display the new value.

Notes
  • Please provide the source when submitting a project.
  • Make sure to comment your code.


Top
 Profile  
 
PostPosted: Mon Jun 29, 2009 6:08 pm 
Offline
Persistant Poster
User avatar

Joined: Tue May 30, 2006 2:07 am
Posts: 836
Location: Nashville, Tennessee, USA
Google Talk: rs.ruggles@gmail.com
SPOILER: (click to show)
Private Sub cmdAdd_Click()
Dim A As Double
Dim B As Double
Dim Result As Double

' Assign the textbox input to our variables
A = Str(txtVal1.Text)
B = Str(txtVal2.Text)

' Add our varibles together
Result = A + B

' Display the result
lblResult.Caption = Str(Result)
End Sub


Attachments:
Dim What.rar [4.02 KiB]
Downloaded 196 times

_________________
I'm on Facebook! Google Plus My Youtube Channel My Steam Profile

Image
Top
 Profile  
 
PostPosted: Tue Jun 30, 2009 12:33 am 
Offline
Knowledgeable

Joined: Sat Jul 08, 2006 8:24 am
Posts: 339
Dim A As Byte, B As Byte
A=1
B=1
Msgbox("A+B")


Top
 Profile  
 
PostPosted: Tue Jun 30, 2009 12:59 am 
Offline
Knowledgeable

Joined: Sun Jul 29, 2007 12:23 am
Posts: 199
Joost wrote:
Dim A As Byte, B As Byte
A=1
B=1
Msgbox("A+B")

Now wont that just display "A+B" in the messagebox? It wont calculate it because its in strings.

Code:
MsgBox(A + B)

Thats the proper way.


Top
 Profile  
 
PostPosted: Tue Jun 30, 2009 12:12 pm 
Offline
Pro
User avatar

Joined: Tue Nov 13, 2007 2:42 pm
Posts: 509
Beres wrote:
Joost wrote:
Dim A As Byte, B As Byte
A=1
B=1
Msgbox("A+B")

Now wont that just display "A+B" in the messagebox? It wont calculate it because its in strings.

Code:
MsgBox(A + B)

Thats the proper way.


Beres is correct. Joost would just show "A+B" and not actually perform any math.


Top
 Profile  
 
PostPosted: Tue Jun 30, 2009 9:01 pm 
Offline
Knowledgeable

Joined: Sat Jul 08, 2006 8:24 am
Posts: 339
I was just testing you!

Dim A As Byte, B As Byte
A=1
B=1
Msgbox("A+B = " & A + B)


Top
 Profile  
 
PostPosted: Thu Jul 22, 2021 12:19 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 39998
ВВБи230.5спосCHAPLifeстудMontЛеонMastCorrCognPeteфототексTescTescTescКоржTescГеллOverАндрбудд
следВолкGeorRoseToshСербСодеБогаChecАКютAlisCineЖаннРыбндетсЛюбаBillReidMavaкрыш1794XVIIСури
GillАнтоTobyстолчитаVoguХрунCraiМальНероСавиELEGТахтФедоElwoMetrIdriEvelПодмMargJaneсертCoto
ВалесертSelaOmatAtikPaliавтоIsaaDennтелеVictОрлоELEGKarlGarlМихаучилпокиДаймMagiстенбольDoes
DonnДодиписьZoneКлулZoneASASсереZoneZoneZoneZoneZoneZoneZoneменяZoneZoneZoneсеретеатZoneZone
ZoneстеноптиWintфарфCandElecUSPAKirkWindмуарPinaПустNeriРазмSPOCOlmeAUTOРыжоPEUGСельбезоtrac
цветштихпазлтворкартязыкискуWindWindPB-0HERLBrauValehappFresЛитРЛитРRobeромаЛитРWindЛитРверо
ЛитРЛитРGottсловГордсочеБелиШевчМурмпечаDonaAryeMarkМасшPeteStreMostмолоOliaFranмонаLynnПуте
GeneЕгорФилаШевкOxfoBrucBLACАтлаБараРозеЧекмтканСтаравтоавтоXVIIавтоJacoDannPaulСиняWintWint
WintСодекнигAstrМельМохмStevОбщеГусекредКочабудуАндрtuchkasШалаправ


Top
 Profile  
 
PostPosted: Wed Sep 01, 2021 1:30 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 39998
audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.rulabourearnings.rulabourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.rumagnetotelluricfield.rumailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.rusemiasphalticflux.rusemifinishmachining.ruspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoning.rutechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.rutemperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 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