Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


GPS and Conversion


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-13-2007, 07:31 PM
Junior Member
 
Join Date: Oct 2007
Location: Italy
Posts: 25
Default GPS and Conversion

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?
Reply With Quote
  #2 (permalink)  
Old 11-13-2007, 07:55 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 672
Default

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
Reply With Quote
  #3 (permalink)  
Old 11-13-2007, 07:57 PM
Junior Member
 
Join Date: Oct 2007
Location: Italy
Posts: 25
Default

Thank you, specci, now i try....
Reply With Quote
  #4 (permalink)  
Old 11-13-2007, 07:59 PM
Junior Member
 
Join Date: Oct 2007
Location: Italy
Posts: 25
Default

I obtain the same error : why
Reply With Quote
  #5 (permalink)  
Old 11-13-2007, 08:11 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 672
Default

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.
Reply With Quote
  #6 (permalink)  
Old 11-13-2007, 08:19 PM
Junior Member
 
Join Date: Oct 2007
Location: Italy
Posts: 25
Default

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...
Reply With Quote
  #7 (permalink)  
Old 11-13-2007, 10:29 PM
Junior Member
 
Join Date: Oct 2007
Location: Italy
Posts: 25
Default

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!!!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Petite question sur la conversion d'un code VB6 en Basic4ppc GallyHC French Forum 11 05-27-2008 02:25 PM
How Is This Conversion An Error? Louis Bug Reports 3 11-20-2007 09:02 AM
Conversion and trig functs bdiscount Additional Libraries 0 10-08-2007 04:55 PM
Numeric conversion limitation? agraham Bug Reports 5 07-06-2007 06:08 PM


All times are GMT. The time now is 07:09 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0