r/visualbasic • • Oct 23 '18

I'm making a program to convert Celsius to Fahrenheit for school and I do not understand what is not working

'This is my code

'I think there is something wrong with the math because when I try and convert it, the numbers are not right.

'Also, I would like to make it that If the temperature is above 0° then the background image changes to a sun. And if it's under 0° then the background image changes to like snow or something.

'**********************************************************************

'Programmeur: Lucas Després *

'Date: Octobre 2018 *

'But: De convertir les unité de mesure de la température *

'a Celcius et Fahrenheit et vice versa *

'**********************************************************************

Public Class frmConversion

Private Sub frmConversion_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

'Crée un Integer pour Fahrenhei et Celcius

Dim intF As Integer

Dim intC As Integer

intC = Val(txtbxEntree1.Text)

intF = Val(txtbxEntree2.Text)

intF = (9 / 5) * (intC + 32)

intC = (5 / 9) * (intF - 32)

Me.txtbxEntree2.Text = intF

End Sub

End Class

'Please help me fix this

5 Upvotes

10 comments sorted by

View all comments

Show parent comments

1

u/Despresl144 Oct 25 '18

What is a double?

1

u/andrewsmd87 Web Specialist Oct 25 '18

similar to a decimal (which you could also use) the difference between the two is how they're stored