Format displayed format

devjet

Member
Licensed User
Longtime User
I have been searching the forum and the documents but somehow the info was still not clear to me.
I like to format the GPS output in order to get only 2 decimals in the "lblAltitude" view

Code: Copy
lblAltitude.Text ="Alt = " & Location1.Altitude

I have been playing with this but always got an error
Log(NumberFormat2(12345.67, 0, 3, 3, false)) '"12345.670"

Thanks
 
What sort of error are you getting?

Are you checking that the fix includes an altitude value (AltitudeValid = true)?
 
Upvote 0
the not corrected value has some 10 digits after the comma displayed in the lbl View
The problem is, that it stretches the View out of proportian as it turncates in to multiple lines.

Code: Copy
Sub GPS_LocationChanged (Location1 As Location) 
   lblLat1.Text = "LAT = " & Location1.ConvertToMinutes(Location1.Latitude)
   lblLon1.Text = "LON = " & Location1.ConvertToMinutes(Location1.Longitude)
   lbllat.Text = "Lat = " & location1.Latitude
   lblLon.Text = "Lon = " & Location1.Longitude
   lblSpeed.Text = "Speed = " & Location1.Speed
   lblAltitude.Text ="Alt = " & Location1.Altitude
   lblBearing.Text="HDG = " & Location1.Bearing  
End Sub

Does the formating have to be applyed to the "lblAltitude" View or the "Location1.Altitude"?
 
Last edited:
Upvote 0
The formatting would be applied to Location1.Altitude
Code: Copy
lblAltitude.Text ="Alt = " & NumberFormat2 (Location1.Altitude, 0, 3, 3, False)
 
Upvote 0
Back
Top