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

Discussion in 'Bug Reports' started by Eveready, Feb 12, 2009.

  1. Eveready

    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?
     
  2. Cableguy

    Cableguy Expert Licensed 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..(=,<>)

    Code:
    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....
     
  3. Eveready

    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. :)
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You can also use StrCompare to compare strings by their lexicographic order.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice