last updated 11/21/2010REALBasic How To's
val( ) --How to convert a Text/String to a Number/Integer (use the val( ) method to convert the value from a String in order to do a mathematical operation)
Dim numberString as String
numberString = "5"
Textfield1.text = val(textfield2.text) + val(numberString)
str( ) --How to convert an Integer/Double (Number) to a String/Text (use the str( ) method to convert a mathematical number to a String in order to display it in a text field such as a StaticText.text or Textfield.text)
Dim num1 as Integer
Textfield1.text = str(val(textfield2.text) + val(numberString))
or
num1 = val(textfield2.text) + val(numberString)
textfield1.text = str(num1)
How to use a radioButon
The value of RadioButton.value is set to True or False depending on whether the RadioButton is checked and False if it is not checked.
For example
if RadioButton1.value = true then
Msgbox "You have picked RadioButton1"
elseif RadioButton1.value = false then
Msgbox "RadioButton1 was not picked"
end if
Common Syntax Errors to Look out for
For an assignment the name goes on the left side of the = and the value goes on the right side.
Excerpt from REALbasic By Matt Neuburg (for educational purposes only)
lvalue = rvalue
for example:
Dim StudentName as String
StudentName = "Jennifer"