lancaster123 Posted March 9, 2016 Report Share Posted March 9, 2016 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 Link to comment Share on other sites More sharing options...
cknipe Posted March 10, 2016 Report Share Posted March 10, 2016 lat.DecimalDegrees.ToString("F7") should do it :smile: Link to comment Share on other sites More sharing options...
Paul Henty Posted March 10, 2016 Report Share Posted March 10, 2016 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 Link to comment Share on other sites More sharing options...
lancaster123 Posted March 10, 2016 Author Report Share Posted March 10, 2016 thanks guys all sorted now Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now