String to Integer keyword needed!

SarahWard

Banned
I would suggest there is something basic and really important missing from B4A.

You NEED some way of converting the string to an integer or numeric variable otherwise you will find users will keep coming up against this generic error message 'NUMBERFORMATERROR'. Frankly, it shouldn't be this complicated to use or access a number held in a string.

A number held in a string is only really easily used as a string (in printing it out in a message box, for example. When you actually come to USING it as a number you get errors all over the place. I even get errors when I try to copy the number value from the string variable/array into an INT variable!

As you can only read numeric values from a file into a string or string array we need a way of using this string.

The 'numberformaterror' message is useless as it is a generic, no information message. It tells us nothing that will help us see why our code isn't working. It seems to always come up when trying to use a number held in a string.
 

warwound

Expert
Licensed User
Longtime User

Ennesima77

Member
Licensed User
Longtime User
I have a similar problem, but it is a little different.
I use the DBUtils to read some infomation from a DB, one of my column is a Boolean and when It was reed return "1" or "0" as string.
If I use this code
chkSendSMS.Chechked=Data.Get("sendsms")
to check a CheckBox it give me and error (somethink like it's impossibile conver a number in boolean)
For this reason I use this code
If Data.Get("sendsms")="1" Then
chkSendSMS.Checked=True
Else
chkSendSMS.Checked=False
End If
But if I use just 1 and not "1" it doesn't work.

Thanks for you kindly reply
 
Top