[RESOLVED] Length Converter
http://i35.photobucket.com/albums/d1...50sxf/help.jpg
total inches = 63360*miles + 36*yards + 12*feet +inches
I need to calculate the total inches
total meters = total inches/39.97
Then convert it in meters
Kilometers = Int(meters/1000)
And then covert that into Metric. Now im lost. I tried :
VB Code:
Dim miles, yards, feet, inches, kilometers As Single
Dim totalinches, totalmeters, totalcm As Double
miles = txtmiles.Text * 63360
yards = txtyards.Text * 36
feet = txtfeet.Text * 12
inches = txtinches.Text
totalinches = miles + yards + feet + inches
totalmeters = (FormatNumber(totalinches / 39.37, 0))
totalcm = (FormatNumber(totalinches / 3937, 1))
kilometers = Int(totalmeters / 1000)
txtansmetric.Text = "The metric length is " & kilometers & " kilometers " & totalmeters & " meters " & totalcm & " centimeters."
which works, but it shows the Complete inches in Kilometers, the Complete inches in meters, and the Complete inches in Centimeters. I need to tamke it calculate perfectly, like:
Miles = 5
Yards = 20
Feet = 2
Inches = 4
which would result in:
the metric length is 8 kilometers, 65 meters, and 73.5 centimeters
Thanks to anyone that can help :afrog: