i try to make some temperature converter program, here is the source code:
but why when i'm start type about 1 - 2 digits number/characters, it always stopped, a message pops and said:
An unhandled exception of type 'System.InvalidCastException' occurred in Temperature Converter.exe
Additional information: Unable to cast object of type 'Temperature_Converter.temp_conv' to type 'System.EventArgs'.
i don't know why, can somebody explain what's going on?
Code:
Public Class temp_conv
Private Sub strp_menu_about_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles strp_menu_about.Click
about_frm.Show()
End Sub
Private Sub strp_menu_exit_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles strp_menu_exit.Click
Me.Close()
End Sub
Private Sub temp_conv_keyup(ByVal sender As System.EventArgs, ByVal e As Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
If e.KeyCode = Keys.Escape Then
txt_box_convert_to.Text = ""
txt_box_from.Text = ""
Else
End If
End Sub
Private Sub btn_convert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_convert.Click
If celsius_one.Checked Then
If celsius_two.Checked Then
txt_box_convert_to.Text = txt_box_from.Text
End If
celsius(Double.Parse(txt_box_from.Text))
ElseIf fahrenheit_one.Checked Then
If fahrenheit_two.Checked Then
txt_box_convert_to.Text = txt_box_from.Text
End If
fahrenheit(Double.Parse(txt_box_from.Text))
ElseIf kelvin_one.Checked Then
If kelvin_two.Checked Then
txt_box_convert_to.Text = txt_box_from.Text
End If
kelvin(Double.Parse(txt_box_from.Text))
Else
MsgBox("you don't submit a valid input...", MsgBoxStyle.Critical, "Error!")
End If
End Sub
Private Function celsius(ByVal deg As Double)
End Function
Private Function fahrenheit(ByVal deg As Double)
End Function
Private Function kelvin(ByVal deg As Double)
End Function
End ClassQuote:
An unhandled exception of type 'System.InvalidCastException' occurred in Temperature Converter.exe
Additional information: Unable to cast object of type 'Temperature_Converter.temp_conv' to type 'System.EventArgs'.