borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (DataGridView remove CurrentRow header triangle)Next Topic (error when commiting the row to the original data store(urgent)) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : Please help me
Poster Message
Ghobashi
Level: Sage


Registered: 28-02-2003
Posts: 61

icon Please help me

Hello
I have a text file with alot of observations in Degree minutes seconds
I want to develope the attached code so as to read from the file and then convert it to decimal format
can you help me?
If the text file's  name  is "coordinates"


Private Function invert() As Double
   ' Declare the variables to be double precision floating-point.
   Dim degrees As Double
   Dim minutes As Double
   Dim seconds As Double
   Dim sixarc As String
   sixarc = "10° 27' 36"""
   ' Set degree to value before "°" of Argument Passed
   degrees = Val(Left(sixarc, InStr(1, sixarc, "°") - 1))
   ' Set minutes to the value between the "°" and the "'"
   ' of the text string for the variable Degree_Deg divided
   ' 60. The Val function converts the text string to a number.
   minutes = Val(Mid(sixarc, InStr(1, sixarc, "°") + 2, _
             InStr(1, sixarc, "'") - InStr(1, sixarc, _
             "°") - 2)) / 60
    ' Set seconds to the number to the right of "'" that is
    ' converted to a value and then divided by 3600.
    seconds = Val(Mid(sixarc, InStr(1, sixarc, "'") + _
            2, Len(sixarc) - InStr(1, sixarc, "'") - 2)) _
            / 3600
   MsgBox degrees + minutes + seconds
End Function


____________________________
with Respect

24-07-2007 at 12:27 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB.Net : Please help me
Previous Topic (DataGridView remove CurrentRow header triangle)Next Topic (error when commiting the row to the original data store(urgent)) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder