IsNumeric

From Xojo Documentation

Method

Indicates whether the value passed is numeric.

Syntax

result=IsNumeric(arg)

Part Type Description
result Boolean True if arg is numeric; False otherwise.
arg Variable, value, or object whose data type is being investigated.

Notes

A common usage of IsNumeric is to determine whether a user entered a string that can be converted to a number.

Strings greater than 127 characters always return False.

Examples

If the value passed to IsNumeric is a String that contains the string version of a number, then IsNumeric returns True. For example this code returns True:

Dim b As Boolean
b = IsNumeric("3.1416")

This code returns False:

Dim b As Boolean
b = IsNumeric("Hello")

Check a user-entered string:

Dim value As Double
Dim b As Boolean
b = IsNumeric(TextField1.Text)
If b Then
value = Val(TextField1.Text)
End If

See Also

Boolean, Byte, Color, Currency, Double, Int8, Int16, Int32, Int64, Single, String, UInt8, UInt16, UInt32, UInt64, Variant data types.