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.


Number format


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-30-2007, 05:03 PM
Newbie
 
Join Date: Oct 2007
Posts: 1
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: 3,199
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 On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 04:35 AM.


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