How does one set the format for a textbox on a form to accept either time degrees or decimal degrees?
How does one set the format for a textbox on a form to accept either time degrees or decimal degrees?
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
A TextBox holds text, String Values.
TextBox1 reads as : 150.82375927TextBox1.Value = CStr(DecimalDegreeNumber) TextBox2.Value = Degrees & "*:" & Minutes & "':" & Seconds & """
TextBox2 reads as: 150*:13':34.395"
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ
Hmmm, what about if I wanted to put a cat amongst the pidgeons by only wanting Degrees &"." & Minutes &"." & Seconds in the form of
23.45.789 or 150.56.345
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
did you tryformat(2345789,"@@@.@@.@@@")
@snb, I did try to write it as txtLatitude1.Value = Format(txtLatitude1.Value, "00.00.000") but haven't tested it yet.
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
Use Left(CStr(Seconds * 10), 3)
If the starting value is Decimal degrees, you will have to convert it to Degrees, Minutes Seconds.
By definition, in D:M:S Nomenclature, Degrees are integers from 0 to 359 or from -179 to +179, Minutes are integers from 0 to 59, and seconds are doubles from 0 to 59.999...
For decimal Degrees, Degrees are doubles from -179.999... to +179.999...
Thought Experiment:
Function ConvertToDMS(DecDegree As Double) As Variant Dim NegativeSign As Boolean 'DecDegree is Double Dim dmsDegree As Int Dim DecMinute As Double Dim dmsMinute As Int Dim dmsSecond As Double NegativeSign = DecDegree < 0 If NegativeSign then DecDegree = DecDegree * -1 dmsDegree = Int(DecDegree) DecMinute = DecDegree - dmsDegree dmsMinute = Int(DecMinute * 60) dmsSecond = (DecMinute - dmsMinute) * 60 If NegativeSign Then dmsDegree = dmsDegree * -1 ConvertToDMS = Array(dmsDegree, dmsMinute, dmsSecond) End Function
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ
I changed the format in #4 to format(y,"@@@.@@.@@@")
@SamT
Not for latitudes of courseFor decimal Degrees, Degrees are doubles from -179.999... to +179.999...
---------------------------------------------------------------------------------------------------------------------
Paul
Remember: Tell us WHAT you want to do, not HOW you think you want to do it
1. Use [CODE] ....[/CODE ] Tags for readability
[CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
2. Upload an example
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
3. Mark the thread as [Solved] when you have an answer
Thread Tools (on the top right corner, above the first message)
4. Read the Forum FAQ, especially the part about cross-posting in other forums
http://www.vbaexpress.com/forum/faq...._new_faq_item3
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ
---------------------------------------------------------------------------------------------------------------------
Paul
Remember: Tell us WHAT you want to do, not HOW you think you want to do it
1. Use [CODE] ....[/CODE ] Tags for readability
[CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
2. Upload an example
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
3. Mark the thread as [Solved] when you have an answer
Thread Tools (on the top right corner, above the first message)
4. Read the Forum FAQ, especially the part about cross-posting in other forums
http://www.vbaexpress.com/forum/faq...._new_faq_item3