GPS and Conversion

Discussion in 'Questions (Windows Mobile)' started by forisco, Nov 13, 2007.

  1. forisco

    forisco Member Licensed User

    Hi,
    if i write this :

    lat = GPS.latitude
    gradi = SubString(lat,0,2)
    minuti = SubString(lat,2,2)
    secondi = SubString(lat,5,4)
    secondi = (minuti*0.6-Int(minuti*0.6))*60+secondi*0.0036

    i obtain the FormatException error : why?
     
  2. specci48

    specci48 Well-Known Member Licensed User

    Hi forisco,

    gps.latitude has the format ddmm.mm
    So you should use:
    secondi = SubString(lat,5,2)

    Basic4ppc will not throw an error, if a SubString statement exceeds the original StrLength.


    specci48
     
  3. forisco

    forisco Member Licensed User

    Thank you, specci, now i try....
     
  4. forisco

    forisco Member Licensed User

    I obtain the same error : why :sign0148:
     
  5. specci48

    specci48 Well-Known Member Licensed User

    Do you get a correct latitude? What is the value of lat?
    If you a developing on the device you could use a MsgBox for debugging.
     
  6. forisco

    forisco Member Licensed User

    If i show only the lat variable, i obtain 4019.671835
    The latitude is correct. The error is in the last line :

    secondi = (minuti*0.6-Int(minuti*0.6))*60+secondi*0.0036

    and i obtain the same error if i use a calculation in an other line, for example :

    minuti = SubString(lat,2,2) * 0.6

    It seem that b4ppc don't convert the SubString function in number...
     
  7. forisco

    forisco Member Licensed User

    I solved my problem thanks to an old answer of Erel (simply, the best)!

    When the GPS not send data, the gps.latitude variable is empty and i have my error!

    I must check if gps works (with the status property) and all work fine!!!!

    Wowwwwwwwww!!! :sign0136:
     
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