How to convert Strings with Val()


val.png
' Gambas class file

PUBLIC SUB _new()
  TextLabel1.Text="Type in something that looks like an 
" & "Integer, Float or Boolean" END PUBLIC SUB Button1_Click() x AS Variant x = Val(TextBox1.Text) IF IsBoolean(x) THEN Label1.Text="This is a Boolean!" ENDIF IF IsInteger(x) THEN Label1.Text="This is an Integer!" ENDIF IF IsFloat(x) THEN Label1.Text="This is a Float!" ENDIF IF IsString(x) THEN Label1.Text="This is a String!" ENDIF END

-- JochenGeorges - 28 Dec 2004