Answer to Question #10929 in Visual Basic for APRIL

Question #10929
ned two independent Sub procedures: one to convert a temperature from fahrenheit to Celsius and the other to convert fahrenheit to celsius.
1
Expert's answer
2012-11-12T08:18:26-0500
Dim celcius As Decimal = 0D
Dim fahrenheit As Decimal = 0D
Dim f As Decimal
Dim c As Decimal
celcius = Decimal.Parse(celTextBox.Text)
fahrenheit = Decimal.Parse(fahTextBox.Text)
'celcius to farenheit formula:
If celcius > 0 Then
#039; Notice the conversion from our decimal value to String
#039; Before placing it into the textbox
fahTextBox.Text = Convert.ToString(c * 1.8 + 32)
Else
MessageBox.Show("Enter celcius greater than 0")
End If
'farenheit to celcius formula:
If fahrenheit > 0 Then
#039; Again we convert from a decimal value to a string before
#039; placing into textbox
celTextBox.Text = Convert.ToString(f - 32 / 1.8)
Else
MessageBox.Show("Enter fahrenheit greater than 0")
End If

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS