Data Types to know
Boolean- ture or false values
Integer-whole numbers
Deciamls- deciaml value
Naming a variabnle
nopuncuation
first name starts with lovercase letter 2nd iscapital
Declare Variable
Syntax know order
Dim item As Integer
Assing A variable
Dim price as integer
price = 500
Dim name as String
name = "Mary" when giving a string value put in " "
Notes
Naming a varibale-
Rules-
1.The name must begin with a letter or an underscore
2.The name must contain onlyletters, numbers and the underscore charcater. NO puncuation or spaces allowed
3.16383 chratces possible but 32 is reccomneded for name
4.NO reserved namel like print
Flowcharts
Ovals= start and stop
Parellagram = inputs and outputs
Dimond = your decisioins, true/fasle, repetiton
regtangle = calculations or processes
Declaring a Variable you must makea declaratiion statement.
Dim itemPrice As Decimal,
Dim discountPrice As Decimal
This declares two decimal variables named itemPrice and discount; the variabls are automatically initalized to 0
Dim isDataOk As Boolean = True
declares a bnollean variable name isDataOk and initializes it using the keyword True
Dim student As String
Dim age As Integer
decllares a srting variable named studentname and an integr variable named age the string variable is auto initalized to nothing and the integer variable is auto 0
Assign A Value
Dim quantityOrdered As Integer
quantityOrdered = 500
assigns the integer 500 to an integer variable named quantityOrdered
Dim firstName As String
firstName = "Mary"
assugns the string "Mary" toi a string variable named firstName
Dim zipCode As String
zipCode = zipTextBox.text
assings teh string contained in ziptextbox text property to a string variable named zipcode
TryPrase
Dim isconverted As Boolean
Dim sales As Decimal
isconverted = decimal.tryparse(salestextbox.text, _
NumberStyles.currency, NumberFormatInfo.Currentinfo, _
Sales)
If condition than
Ex:
if partNumber = "AB203" Then
price = price * 1.1
messagelabel.text = "Price increase"
If sales >1500 than
commissioin = .2D * sales
else
Concarenate String
firstName & lastName= JustGluck
firstName & " " & lastName = Just Gluck
lastName & ", " & firstName = Gluck, Justin
"She is " & convert.toString(age) & "!" = She is 21!
"She is
commission = .1d * sales
End If
Thursday, February 26, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment