Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Number format

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-30-2007, 05:03 PM
Newbie
 
Join Date: Oct 2007
Posts: 2
Default Number format

I have a Listbox that is displaying the GPS altitude but i would like to limit the number of decimal places to 2. i was looking through help topics but it was not very clear to me, being a new user.

current code:
Sub GPS_GPSDecoded
ListBox1.Clear
ListBox1.add(GPS.status)
ListBox2.Clear
ListBox2.Add(GPS.NumberOfSatellites)
ListBox3.Clear
ListBox3.add(GPS.SpeedOverGround)
ListBox4.Clear
ListBox4.Add(GPS.CourseOverGround)
ListBox5.Clear
ListBox5.Add(GPS.Altitude * 3.28084)
End Sub

Any help would be great,

(just got this software this morning and so far i love it)
Reply With Quote
  #2 (permalink)  
Old 10-30-2007, 05:17 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

You should use the Format keyword:
Code:
ListBox5.Add(Format(GPS.Altitude * 3.28084,"n2"))
GPS.Altitude is parsed from the GPS string.
You should check if it is not an empty string (there is no altitude value):
Code:
If GPS.Altitude <> "" Then
  ListBox5.Add(Format(
GPS.Altitude * 3.28084,"n2"))
End If
BTW, why don't you use a TextBox or a Label instead of the ListBoxes?
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 Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get telephone number of your own Pocketpc cotralis Questions (Windows Mobile) 2 09-09-2008 05:49 PM
How to get imei number ? gjoisa Questions (Windows Mobile) 9 06-26-2008 07:59 AM
serious number crunching cpc6128 Questions (Windows Mobile) 4 03-13-2008 02:24 AM
Help to generate serial number... belotrei Questions (Windows Mobile) 31 02-29-2008 02:29 PM
Serial Number Cableguy Questions (Windows Mobile) 4 05-05-2007 08:06 AM


All times are GMT. The time now is 10:10 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0