Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi Guys

 

Im trying to make a application in vb.net using the dll

 

im using this code out of the user guide:

Dim playerLatitude As Offset(Of Long) = New Offset(Of Long)(&H560) 
Dim playerLongitude As Offset(Of Long) = New Offset(Of Long)(&H568) 
Private Sub DisplayCurrentPosition() 
' Create new instances of FsLongitude and FsLatitude using the 
' raw 8-Byte data from the FSUIPC Offsets 
FSUIPCConnection.Process() 
Dim lon As FsLongitude = New FsLongitude(playerLongitude.Value) 
Dim lat As FsLatitude = New FsLatitude(playerLatitude.Value) 
' Use the ToString() method to output in human readable form: 
Me.txtLatitude.Text = lat.ToString() 
Me.txtLongitude.Text = lon.ToString() 
End Sub 

and its working fine but I wondered if there was a way to display decimal degrees in the lat lon text boxes instead of converting them to DMS?

 

Many Thanks

Scott

Posted

As cknipe rightly says, using DecimalDegrees will let you format it however you like.

 

Alternatively, you can also use the ToString() method. This will keep the padded three-digit degree number, and for longitude will also do E/W if you like.

lat.ToString("d", 6)

Where "d" means decimals only and 6 is the number of decimal places.

lon.ToString(True, "d", 6)

The "True" here means show E and W. If you set it to False you just get the plain number with - for west values.

 

 

Paul

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.