This is the code that I have written to have a message box come up if a nonnumeric value is put in the input box. However, when I try the program, no message box comes up with my comments in it. What am I doing wrong and how can I fix it?
CODE
Public Class FrmErrors2
Dim I As Long
Dim lngSum As Long
Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnProcess.Click
Try
For I = txtStartLoop.Text To txtEndLoop.Text
lngSum = (lngSum + I) * I
Next
Catch theException As FormatException
MessageBox.Show("enter numeric data", "Data Entry Error", MessageBoxButtons.OK)
End Try
Try
lblResults.Text = lngSum
lngSum = TxtDividend.Text / TxtDivisor.Text
lblDivideResults.Text = lngSum
Catch theException As FormatException
MessageBox.Show("Enter numeric data.")
End Try
TxtDisappears.Visible = txtSetVisible.Text
End Sub
End Class