0% found this document useful (0 votes)
94 views

Exercise 2

This program allows the user to convert between Celsius and Fahrenheit temperatures. It contains code to handle button clicks that perform the conversions using appropriate formulas. It also contains code to update the user interface such as labels and buttons depending on whether Celsius or Fahrenheit is selected.

Uploaded by

api-310300017
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views

Exercise 2

This program allows the user to convert between Celsius and Fahrenheit temperatures. It contains code to handle button clicks that perform the conversions using appropriate formulas. It also contains code to update the user interface such as labels and buttons depending on whether Celsius or Fahrenheit is selected.

Uploaded by

api-310300017
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Public Class Form1

Dim FAH As Integer


Dim CEL As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
FAH = TextBox1.Text
Label3.Text = 5 / 9 * (FAH - 32)
End Sub
Private Sub CelsiusToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CelsiusToolStripMenuItem.Click
Label1.Text = "Enter the temperature in Celsius:"
Label2.Text = "The Temperature in Fahrenheit is:"
Button1.Visible = False
Button2.Visible = True
FahrenheitToolStripMenuItem.Checked = False
End Sub
Private Sub FahrenheitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles FahrenheitToolStripMenuItem.Click
Label1.Text = "Enter the temperature in Fahrenheit:"
Label2.Text = "The Temperature in Celsius is:"
Button1.Text = "Celsius"
Button2.Visible = False
Button1.Visible = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
CEL = TextBox1.Text
Label3.Text = CEL * 9 / 5 + 35
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ExitToolStripMenuItem.Click
Close()
End Sub
End Class

You might also like