Project is to create a solution that converts standard to metric. Input is miles, yards, feet, and inches and that input should get converted to kilometers, meters, centimeters, millimeters, and microns.
An example of a correct calculation is : 1 inch = 2cm, 5mm, 400 microns.
(1) I'm having 2 issues. I can't figure out how to get the calculations. The correct calculation was from her example showing some code to guide us along. I'm having issues with that and the output. Right now, if I put in 1 inch for the input, my output is '400 microns' and nothing else.
(2) I am now able to display all of my output, but how do I format it so each thing is on its own line?
Any solution or guidance would help tremendously!
edit: Focus issue fixed.
An example of a correct calculation is : 1 inch = 2cm, 5mm, 400 microns.
(1) I'm having 2 issues. I can't figure out how to get the calculations. The correct calculation was from her example showing some code to guide us along. I'm having issues with that and the output. Right now, if I put in 1 inch for the input, my output is '400 microns' and nothing else.
(2) I am now able to display all of my output, but how do I format it so each thing is on its own line?
Code:
'Tim Gabrhel Bus Adm 335-002 Project 1 3/1/2008
Option Explicit On
Option Strict On
Public Class Form1
Private Sub xClearButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xClearButton.Click
'when clicking the clear button, all data is removed and focus sent to first text box
Me.xFeet.Text = ""
Me.xInches.Text = ""
Me.xMiles.Text = ""
Me.xYards.Text = ""
Me.OutputLabel.Text = ""
'sends focus to the miles input after cliking the clear button
xMiles.Focus()
End Sub
Private Sub xExitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xExitButton.Click
'closes the application when clicking the exit button
Me.Close()
End Sub
Private Sub xCovertButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xCovertButton.Click
'declare variables
Dim feet, inch, miles, yards As Long
Dim kilo, meter, cm, mm, mic As Long
'gets input from user
Long.TryParse(Me.xMiles.Text, miles)
Long.TryParse(Me.xYards.Text, yards)
Long.TryParse(Me.xFeet.Text, feet)
Long.TryParse(Me.xInches.Text, inch)
'calculate the results
'CONVERSION CALCULATIONS
'1 foot = 12 inches | 1 yard = 3 feet | 1 mile = 1760 yards | 1 millimeter = 1000 microns
'1 inch = 2.54 centimeters | 1 meter = 100 centimeters | 1 kilometer = 1000 meters
'convert inches into microns
mic = inch * 25400
'number of centimeters
cm = mic \ 10000
'remaining microns
mic = mic Mod 10000
'number of millimeters
mm = mic \ 1000
'remaining microns
mic = mic Mod 1000
'display the results
Me.OutputLabel.Text = "The metric length is:"
Me.OutputLabel.Text = kilo.ToString() & " Kilometers"
Me.OutputLabel.Text = meter.ToString() & " Meters"
Me.OutputLabel.Text = cm.ToString() & " Centimeters"
Me.OutputLabel.Text = mm.ToString() & " Millimeters"
Me.OutputLabel.Text = mic.ToString() & " Microns"
End Sub
End Class
Any solution or guidance would help tremendously!
edit: Focus issue fixed.