.net help

The Slayer

EGO Zealot
Joined
Jan 22, 2010
Messages
1,948
ok, so the exercise is to put fahrenheit to Celsius

C = (F - 32) / 1.8
that's the formula used

Dim dblCelsius As Double
Dim sngFahrenheit As Single

sngFahrenheit = Single.Parse(txtFahrenheit.Text)

dblCelsius = (sngFahrenheit - 32) / 1.8
txtCelsius.Text = dblCelsius.ToString

End Sub

that's my code

now i give in 64.4 in txtFahrenheit. And i get 340? celcius. Now this is impossible as it has to be 18...

Anyone know how to fix this omg, this is annoying me ..
 
I won't tell you exactly what's wrong, cause then you won't learn...

but start by the most basic steps..something i still do after 15 years of developing...

print out every variable before and after you do something with them.. For example, what does sngFahrenheit equal AFTER you do the "Single.Parse)" thing.

Make sure everything contains what you really think they do.
 
Wow, thank u bigD. I found my problem. I put this:

sngFahrenheit = Single.Parse(txtFahrenheit.Text)
MessageBox.Show(sngFahrenheit.ToString)

turned out, when i use a '.' as a comma, it sees it at 644 instead of 64.4. I tried with a ',' worked.

Thanks =D
 
Last edited:

Latest posts

Back
Top