I have a drop down combobox, the user selects (for example) "Feet to Metres", the user enters an amount in feet into a text box and then upon clicking the convert button will calculate the conversion.
This calculation works fine if I entered in "6ft" or "5ft" but not if I enter in 6.2 (ie 6'2") as there are 12 inches per 1 feet.
How would I overcome this?
This calculation works fine if I entered in "6ft" or "5ft" but not if I enter in 6.2 (ie 6'2") as there are 12 inches per 1 feet.
How would I overcome this?
VB.NET:
Private Sub btnImpConv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImpConv.Click
'Imperial
Dim feet, result As Double
'Feet to Metres
If cmbImp.SelectedItem = "Feet to Metres" Then
feet = CDbl(txtiInput.Text)
result = feet * 0.3048
lblOutput.Text = "Metres: " + result.ToString()
End If
End Sub
Private Sub frmConv_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Imperial
cmbImp.Items.Add("Feet to Metres")
End Sub