Paso 3: Conversión de las unidades
Paso 15: Inserte el siguiente debajo del código anterior:
'What it is converting' If LengthList1.Text = ("Mile") And LengthList2.Text = ("Kilometre") Then Mile1 = True KM2 = True End If 'The equation for the conversion' If Mile1 = True and KM2 = True Then UnitText2.Text = Num1 / 0.62137 End If If LengthList1.Text = ("Mile") And LengthList2.Text = ("Metre") Then Mile1 = True M2 = True End If If Mile1 = True and M2 = True Then UnitText2.Text = Num1 / 0.0062137 End If If LengthList1.Text = ("Mile") And LengthList2.Text = ("Centimetre") Then Mile1 = True CM2 = True End If If Mile1 = True and CM2 = True Then UnitText2.Text = Num1 / 0.0000062137 End If If LengthList1.Text = ("Kilometre") And LengthList2.Text = ("Mile") Then KM1 = True Mile2 = True End If If KM1 = True and Mile2 = True Then UnitText2.Text = Num1 * 0.62137 End If If LengthList1.Text = ("Kilometre") And LengthList2.Text = ("Metre") Then KM1 = True M2 = True End If If KM1 = True and M2 = True Then UnitText2.Text = Num1 / 0.001 End If If LengthList1.Text = ("Kilometre") And LengthList2.Text = ("Centimetre") Then KM1 = True CM2 = True End If If KM1 = True and CM2 = True Then UnitText2.Text = Num1 / 0.000001 End If If LengthList1.Text = ("Metre") And LengthList2.Text = ("Mile") Then M1 = True Mile2 = True End If If M1 = True and Mile2 = True Then UnitText2.Text = Num1 * 0.000621317 End If If LengthList1.Text = ("Metre") And LengthList2.Text = ("Kilometre") Then M1 = True KM2 = True End If If M1 = True and KM2 = True Then UnitText2.Text = Num1 / 1000 End If If LengthList1.Text = ("Metre") And LengthList2.Text = ("Centimetre") Then M1 = True CM2 = True End If If M1 = True and CM2 = True Then UnitText2.Text = Num1 / 0.01 End If If LengthList1.Text = ("Centimetre") And LengthList2.Text = ("Mile") Then CM1 = True Mile2 = True End If If CM1 = True and Mile2 = True Then UnitText2.Text = Num1 * 0.000000621317 End If If LengthList1.Text = ("Centimetre") And LengthList2.Text = ("Kilometre") Then CM1 = True KM2 = True End If If CM1 = True and KM2 = True Then UnitText2.Text = Num1 * 0.00001 End If If LengthList1.Text = ("Centimetre") And LengthList2.Text = ("Metre") Then CM1 = True M2 = True End If If CM1 = True and M2 = True Then UnitText2.Text = Num1 * 0.01 End If 'If converting into same unit then the valve will be the same' If LengthList1.Text = LengthList2.Text Then UnitText2.Text = Num1 End If