I have written this conversion tool.I know it is wrong somewhere does anyone know where I am going wrong in this code.
Its supposed to convert a temperature given by the user either from Celsius to Fahrenheit or from Fahrenheit to Celsius.
This bit is especially annoying, the user is supposed to indicate which scale they wish their entry to be converted to.
This is what ive attempted.
Option Explicit
Private Sub cmdConvert_Click()
'Declare required storage space
Dim Fahrenheit As Integer
Dim Celsius As Integer
Dim F As Integer
Dim C As Integer
'Invite user to input temp
Fahrenheit = InputBox("Please input Temp in F for conversion to C ", "Temperature")
Celsius = InputBox("Please input Temp in C for conversion to F ", "Temperature")
F = Fahrenheit
C = Celsius
If Fahrenheit Then
picMessage.Print "The conversion in celsius is "; (5 / 9) * (F - 32)
If Celsius Then
picMessage.Print "The conversion in fahrenheit is "; 32 + (9 / 5) * C
End If
End If
End Sub
Thanks Charlie
Its supposed to convert a temperature given by the user either from Celsius to Fahrenheit or from Fahrenheit to Celsius.
This bit is especially annoying, the user is supposed to indicate which scale they wish their entry to be converted to.
This is what ive attempted.
Option Explicit
Private Sub cmdConvert_Click()
'Declare required storage space
Dim Fahrenheit As Integer
Dim Celsius As Integer
Dim F As Integer
Dim C As Integer
'Invite user to input temp
Fahrenheit = InputBox("Please input Temp in F for conversion to C ", "Temperature")
Celsius = InputBox("Please input Temp in C for conversion to F ", "Temperature")
F = Fahrenheit
C = Celsius
If Fahrenheit Then
picMessage.Print "The conversion in celsius is "; (5 / 9) * (F - 32)
If Celsius Then
picMessage.Print "The conversion in fahrenheit is "; 32 + (9 / 5) * C
End If
End If
End Sub
Thanks Charlie