Wednesday 6 February 2013

Celsius to Fahrenheit Converter in asp.net VB.NET


Celsius to Fahrenheit Converter in asp.net VB.NET


Add 2 textboxes with Auto Postback enabled and TextChange Event handler.


Conversion Formula:

C/5 = F-32/9


Celsius TextBox change Event handler.


  Protected  Sub txtCelsius_TextChanged(ByVal sender As Object, ByVal e As EventArgs)
            Dim outputCelsius As Decimal
            Decimal.TryParse(txtCelsius.Text,out outputCelsius)

            txtFarenheit.Text = String.Format("{0:F2}", ((outputCelsius/5)*9)+32)
   End Sub


Fareinheat TextBox Change Event handler.



  Protected  Sub txtFarenheit_TextChanged(ByVal sender As Object, ByVal e As EventArgs)
            'calendardemo / 5 = false - 32 / 9;
            Dim outputFarein As Decimal
            Decimal.TryParse(txtFarenheit.Text,out outputFarein)
            txtCelsius.Text = String.Format("{0:F2}", (((outputFarein - 32) / 9) * 5))
 End Sub


OUTPUT:

Fahrenheit to CelSIUS Converter in asp.net C# VB.NET
Tags:Celsius to Fahrenheit Converter in asp.net VB.NET,Farenheit to Celsius converter in asp.net,Textbox Autopostback,Textbox Textchange event handler,

No comments:

Post a Comment