Public
Class Form1
Private Sub
TextBox1_Validated(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox1.Validated
Me.ErrorProvider1.SetError(TextBox1,
"")
End Sub
Private Sub
TextBox1_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles
TextBox1.Validating
Try
If Me.TextBox1.Text.Length
= 0 Then
Me.ErrorProvider1.SetError(Me.TextBox1, "Please Enter a value")
Throw New Exception("Please
enter a value")
ElseIf Not
IsNumeric(TextBox1.Text) Then
Me.ErrorProvider1.SetError(Me.TextBox1, "Please Enter a Numeric
Value!")
Throw New
Exception("Please enter a numeric value")
End If
Catch ex As
Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub
TextBox2_Validated(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox2.Validated
Me.ErrorProvider1.SetError(TextBox2,
"")
End Sub
Private Sub
TextBox2_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles
TextBox2.Validating
Try
If Me.TextBox2.Text.Length
= 0 Then
Me.ErrorProvider1.SetError(Me.TextBox2, "Please Enter a value")
Throw New
Exception("Please enter a value")
ElseIf Not
IsNumeric(TextBox2.Text) Then
Me.ErrorProvider1.SetError(Me.TextBox1, "Please Enter a Numeric
Value!")
Throw New
Exception("Please enter a numeric value")
End If
Catch ex As
Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click
Me.Close()
End Sub
End
Class