Private Sub Command1_Click()
Dim num As Single
Dim den As Single
On Error GoTo inputhandler
num = Text1.Text
den = Text2.Text
On Error GoTo dividebyzerohandler
Label3.Caption = "Result is:" & num / den
Exit Sub
dividebyzerohandler:
Label3.Caption = "attempted to divide by zero"
Exit Sub
inputhandler:
Label3.Caption = "attempted to input non-numeric data"
End Sub
Private Sub Command2_Click()
Text1.Text = " "
Text2.Text = " "
Label3.Caption = " "
End Sub
Dim num As Single
Dim den As Single
On Error GoTo inputhandler
num = Text1.Text
den = Text2.Text
On Error GoTo dividebyzerohandler
Label3.Caption = "Result is:" & num / den
Exit Sub
dividebyzerohandler:
Label3.Caption = "attempted to divide by zero"
Exit Sub
inputhandler:
Label3.Caption = "attempted to input non-numeric data"
End Sub
Private Sub Command2_Click()
Text1.Text = " "
Text2.Text = " "
Label3.Caption = " "
End Sub
No comments:
Post a Comment