Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42847

VS 2010 Need help with calculations for Celsius/Fahrenheit Conversion

$
0
0
Hello, I'm in an Intro to Programming Class and we were assigned to create a Temperature Converter application.

My application consists of two labels (fahrenheit, celsius), two textboxes (one for fahrenheit, celsius), and two buttons(calculate celsius, fahrenheit).

I'm a bit confused with how to code the outcome into the selected textbox.
Ex: I type something in the Fahrenheit textbox and when I click the Calculate Celsius button it displays the conversion in the Celsius textbox.

------------------------------
Also, my calculations do not seem to be working.
Code:

Option Strict On
Option Explicit On

Public Class frmCelsiusFahrenheitConversion

    Private Sub btnCalcCelsius_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles btnCalcCelsius.Click
        'Calculates Fahrenheit to Celsius
        Dim Celsius As Single
        Dim Fahrenheit As Single
        Dim strCelsius

        strCelsius = txtCelsius.Text
        Celsius = Fahrenheit * (9 / 5) + 32




    End Sub
End Class

This is what I have so far for one button.

Sorry that this is long, but thank you for helping in advance.

Viewing all articles
Browse latest Browse all 42847

Latest Images

Trending Articles



Latest Images