Results 1 to 7 of 7

Thread: Convert Celsius to Fahrenheit

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2011
    Posts
    14

    Convert Celsius to Fahrenheit

    OK, I've figured out the Variable declaration and coding to make it work:

    Dim Celsius, Fahrenheit As Double

    Try

    Celsius = CDbl(txtCelsius.Text)
    Fahrenheit = 32 + (9 / 5) * CDbl(txtCelsius.Text)
    lblConvertedTemp.Text = CStr(Fahrenheit)

    Catch ex As Exception
    MessageBox.Show("Data input must be numeric", "Error")

    With txtCelsius
    .Focus()
    .SelectAll()
    End With

    End Try

    End Sub

    Now I'm trying to specify the number of decimals in the output lablel and not sure where to put it into the coding?
    Please Help


    hello,
    i have what seems like a simple project that converts Celsius to Fahrenheit.
    I'm having problems creating variables and get an error:

    Private Sub btnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvert.Click


    Dim sngFahrenheitTemp As Single = 1.8
    Dim sngCelsiusTemp As Single = 32


    lblConvertedTemp.Text = (txtCelsius.Text "ERROR HERE" * sngFahrenheitTemp) + sngCelsiusTemp

    lblConvertedTemp.Text = lblConvertedTemp.ToString


    I'm gettting an "error": Option strict on dissallows implicit conversions from string to double????
    I have a textbox for celsius input that I want stored and converted into a label with the Convert Button Click Event.
    Last edited by Gbart; Apr 2nd, 2011 at 04:21 PM. Reason: update on progress

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width