Convert measurement in Miles, Yards, Feet and Inches to a metric measurement in kilometers, meters and centimeters in VB.NET
DESCRIPTION:
Total inches = 63360*miles + 36*yards + 12*feets + inches
Meters = total inches / 39.37
PROPERTIES:
CODEING:
Total inches = 63360*miles + 36*yards + 12*feets + inches
Meters = total inches / 39.37
PROPERTIES:
Button1 | |
Text | Calculate |
Button1 | |
Text | |
ComboBox1 | |
Items | Kilometer |
Meter | |
Centimeter |
Public Class Form1
Dim total_meter As Double
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.Text = "Kilometer" Then
Label5.Text = (total_meter / 39.37) / 1000
ElseIf ComboBox1.Text = "Meter" Then
Label5.Text = total_meter / 39.37
ElseIf ComboBox1.Text = "Centimeter" Then
Label5.Text = (total_meter / 39.37) * 100
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
total_meter = (63360 * Val(TextBox1.Text)) + (36 * Val(TextBox2.Text)) + (12 * Val(TextBox3.Text)) + Val(TextBox4.Text)
Label6.Text = "Total Inches:" & total_meter
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox2.Text = Val(TextBox1.Text) * 1760
TextBox3.Text = Val(TextBox1.Text) * 5280
TextBox4.Text = Val(TextBox3.Text) * 12
End Sub
End Clas
DESIGNING:Dim total_meter As Double
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.Text = "Kilometer" Then
Label5.Text = (total_meter / 39.37) / 1000
ElseIf ComboBox1.Text = "Meter" Then
Label5.Text = total_meter / 39.37
ElseIf ComboBox1.Text = "Centimeter" Then
Label5.Text = (total_meter / 39.37) * 100
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
total_meter = (63360 * Val(TextBox1.Text)) + (36 * Val(TextBox2.Text)) + (12 * Val(TextBox3.Text)) + Val(TextBox4.Text)
Label6.Text = "Total Inches:" & total_meter
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox2.Text = Val(TextBox1.Text) * 1760
TextBox3.Text = Val(TextBox1.Text) * 5280
TextBox4.Text = Val(TextBox3.Text) * 12
End Sub
End Clas
Comments
Post a Comment