If Substring(Textbox.Text,0,1) < "J" Then ' ERROR!!!

Eveready

New Member
An error ocurred on sub main.button1.click

Line number 12

If SubString(Textbox1.Text, 0,1) < "J" Then
Error description:
La cadana de entrada no tiene el formato correcto.
Continue?




PD: Only with equal (=) work fine

¿And if i am making a mistake, what is the way to do that comparison?
 

Cableguy

Expert
Licensed User
Longtime User
How do you what to evaluate a letter?
This is not a bug iut only a misscode..
To evealuate a letter you shouls only compare if it is equal to, or not..(=,<>)

B4X:
If SubString(Textbox1.Text, 0,1) < "J" Then
here you are trying to find if the reulting letters is LESS(?) than "J"..
This cannot be evaluetes this way..

to evaluate this issue, you should first convert your SubString(Textbox1.Text, 0,1) to the ascii table value...and THEN, compare with the ASCII value of the letter"J"...

See the ASC keyword on the main help....
 

Eveready

New Member
Thank you very much for your respond to my post dear friend, and i will try to compare in that way.

Obrigado.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…