|
Hi everyone I need help with this home work i've been programing just for 2 months I should code an application that convert temperature from celsius to fahrenheit and from fahrenheit to celsius there should be two buttons one button uses two independent subs procedures and the other button two function procedures i've been doing this for hours and it does not work and also nothing is highlighted and i dont know what is wrong here is my code
[Option Strict On Option Explicit On
Public Class Form1
Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click Me.Close() End Sub
Private Sub convert1Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles convert1Button.Click
Dim celsius As Decimal Dim fahrenheit As Decimal
celsius = Decimal.Parse(celTextBox.Text) fahrenheit = Decimal.Parse(fahTextBox.Text)
End Sub
Private Sub celsius(ByVal celsius As Decimal)
If celsius <> 0 Then fahTextBox.Text = Convert.ToString(celsius * 1.8 + 32) End If
End Sub
Private Sub fahrenheit(ByVal fahrenheit As Decimal)
If fahrenheit <> 0 Then celTextBox.Text = Convert.ToString(fahrenheit - 32 / 1.8) End If
End Sub Private Sub convert2Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles convert2Button.Click
Dim celsius As Decimal Dim fahrenheit As Decimal
celsius = Decimal.Parse(cel2TextBox.Text) fahrenheit = Decimal.Parse(fah2TextBox.Text)
End Sub
Private Function celsius2(ByVal celsius As Decimal) As Decimal
If celsius <> 0 Then fah2TextBox.Text = Convert.ToString(celsius * 1.8 + 32) End If
End Function
Private Function fahrenheit2(ByVal fahrenheit As Decimal) As Decimal
If fahrenheit <> 0 Then cel2TextBox.Text = Convert.ToString(fahrenheit - 32 / 1.8) End If
End Function End Class]
|