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 :
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: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."
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![]()





Reply With Quote