- Messages
- 42
- Country

Hi Guys
Im writing a application in VB.NET that gets the users coordinates from FS in DMS and then converts them to Decimal Degrees. The conversion is working fine the issue im having is when I parse out the coordinates string to convert.
here is my current code to parse out the coordinates:
but say for example my lat lon was N053° 02.64' W000° 22,03'
it would loose all the 0's so it would return N53° 2.64' W0° 22,3' and that could take to to a different place how can I tell it to keep the 0's in
Many Thanks
Scott
Im writing a application in VB.NET that gets the users coordinates from FS in DMS and then converts them to Decimal Degrees. The conversion is working fine the issue im having is when I parse out the coordinates string to convert.
here is my current code to parse out the coordinates:
Code:
'parse out the Lat N or S
Dim lat_NS As String
lat_NS = Mid(Lat_str, 1, 1)
'parse out the Lat Degrees
Dim lat_Deg As Double
lat_Deg = Mid(Lat_str, 2, 3)
'parse out the Lat Minutes
Dim lat_Min As Double
lat_Min = Mid(Lat_str, 7, 2)
'parse out the Lat Seconds
Dim lat_Sec As Double
lat_Sec = Mid(Lat_str, 10, 2)
'Get Lon in var
Dim Lon_str As String
Lon_str = txtLongitude.Text
'parse out the Lat E or W
Dim lon_EW As String
lon_EW = Mid(Lon_str, 1, 1)
'parse out the Lat Degrees
Dim lon_Deg As Double
lon_Deg = Mid(Lon_str, 2, 3)
'parse out the Lat Minutes
Dim lon_Min As Double
lon_Min = Mid(Lon_str, 7, 2)
'parse out the Lat Seconds
Dim lon_Sec As Double
lon_Sec = Mid(Lon_str, 10, 2)
but say for example my lat lon was N053° 02.64' W000° 22,03'
it would loose all the 0's so it would return N53° 2.64' W0° 22,3' and that could take to to a different place how can I tell it to keep the 0's in
Many Thanks
Scott
