How to Create a Temperature Converter in VB.Net

How to Create a Temperature Converter in VB.Net

This Tutorial is all about How to Create a Temperature Converter in VB.Net. In this tutorial about Temperature Converter in VB.Net, you will be able to convert Celsius to Fahrenheit and Fahrenheit to Celsius. So lets get Started:

  • First is open the Visual Basic, Select File on the menu, then click New and create a new project.

  • Then a New Project Dialog will appear. You can rename your project, depending on what you like to name it. After that click OK

  • After that, design your form like this just like what I’ve shown you below
    Add a Masked Textbox, 2 RadioButton, Label and a Button.

  • The Label in the bottom of the Design will be the Results. So please Erase the text of Label and leave it blank.
  • Go to Convert Button and Add this Following Codes.

[vbnet]

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If RadioButton1.Checked = True Then
Label1.Text = MaskedTextBox1.Text & ” Fahrenheit = ” & (MaskedTextBox1.Text – 32) / 1.8 & ” Celsius”
ElseIf RadioButton2.Checked = True Then
Label1.Text = MaskedTextBox1.Text & ” Celsius = ” & (MaskedTextBox1.Text * 1.8) + 32 & ” Fahrenheit”
End If
End Sub

[/vbnet]

  • Finally Click F5 to run the program.

Ouptut:

 

If you have any comments or suggestions about on How to Create a Temperature Converter in VB.Net, please feel free to contact our webpage.

Download How to Create a Temperature Converter in VB.Net Here

Other Articles Readers might read:

Leave a Comment