SQA Reference Language to Visual Basic - cheat sheet

Use this to check your Visual Basic syntax.

SQA Reference LanguageVB.Net
RECEIVE something FROM KEYBOARD something = InputBox("Please enter something")
or, put a TextBox on your form and call it txtInput then use
something = txtInput.Text
or, if you're getting a number from a TextBox use
something = Val(txtInput.Text
SEND "something" TO DISPLAY MsgBox("something")
or, put a Label on your form and call it lblOutput then use
lblOutput.Text = "Something"
or, put a ListBox on your form and call it lstOutput then use
lstOutput.Items.Add ("Something")
or, put a TextBox on your form and call it txtOutput then use
txtOutput.Text = "Something"
SET something TO whatever Make sure you have declared a variable called something (Dim something As someDataType) then use
something = whatever
FOR counter FROM something TO somethingElse For counter = something To somethingElse
END FOR Next
REPEAT Do
DO LOOP UNTIL something Loop Until something
WHILE something DO Do While something
END WHILE Loop
IF something THEN If something Then
ELSE Else
END IF End If
LENGTH(something) Len(something)
ROUND(something, numberOfDecimalPlaces) Math.Round(something, numberOfDecimalPlaces)
RANDOM(integer in the range min to max) Randomize()
Int(Rnd()* ((max+1)-min))+min

Back to index

mph@ghscomputing.co.uk

Updated 22 January 2019