Hey guys I'm working on some app for school that will be easier for my class to do homework and so on...
Well first of all i got app to convert Degrees, Minutes and Seconds to DECIMAL.
But now i need to get DECIMAL back to Degress, Minutes and Seconds, and i can't get it how to make it because I'm terrible with math formulas... Here is what i done so far:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox4.Text = TextBox1.Text + (TextBox2.Text * 1 / 60) + (TextBox3.Text * 1 / 60 * 1 / 60)
    End Sub
End Class

Textbox1 - Degrees
Textbox2 - Minutes
Textbox3 - Seconds
Textbox4 - DECIMAL RESULT


So if anyone could help me?? Thank you!

Recommended Answers

All 3 Replies

I'm going to give you the logic of what you should do and if you try it and fail I'll help you as needed:
Degrees would be the integer part of textbox4.
Multiply the decimals of textbox4 times 60 and the integer part of the result is the minutes and multiplying the decimals of that result times 3600 (*60*60) will give you the seconds.

Separating the integer from the decimals can be done in a number of ways, IMO the easiest and easiest to recognise is number - math.floor(number) for the decimals and of course math.floor(number) for the integer part

Tryed but failed i dont have so much skills :/ Because when i get this i will need to make app to calculate Longitude and Latitude (Delta FI, Delta Lambda) that is FI2 - FI1 and Lambda2 - Lambda1 but if it is in North or East sign it has it should be positive else negative and many other things need to get :/ if i could get this decimal to degrees it would be good begin :S but i cant so maybe if you have time to help me?

Post your code and we'll see where you went wrong.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.