Hello to the community. I have a small issue with the code below. The first two parts are the same and the third it's a sub routine. My problem it this.
With the first code if an error occurs, it pops up a warning message (txtval sub routine) only once.
With the second code if an error occurs, the warning message goes to a ''loop'' and it keeps poping up unless I close the program. How I can fix that? I need the warning message to pop just once.

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If CheckBox1.Checked = True Then
  Try
  Call txtval(sender)

  MY CODE
  MY CODE
  MY CODE

Catch ex As Exception
   MsgBox("Runtime error. Invalid output. Check again input variables", MsgBoxStyle.Exclamation, "ERROR")

   End Try
End If

End Sub


Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

If CheckBox1.Checked = True Then
  Try
  Call txtval(sender)

  MY CODE
  MY CODE
  MY CODE

Catch ex As Exception
   MsgBox("Runtime error. Invalid output. Check again input variables", MsgBoxStyle.Exclamation, "ERROR")

   End Try
End If

End Sub

Code:
    
Sub txtval(ByVal sender As System.Object)

For Me.J = 0 To 3
If Not IsNumeric(txt(J).Text) Or txt(J).Text = "" Then
MsgBox("Please enter only numbers and fill in all neccessary fields!", MsgBoxStyle.Critical, "WARNING")
Exit Sub
End If
Next J
End Sub