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.
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.
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.
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