I cannot figure out why the code below will not work. The first list box displays all of the controls except the textboxes. Of course, the MsgBox is doing nothing - since it is only looking for textboxes. Why is it not recognizing the textboxes? By the way, I have changed the names on some of my textboxes because I have so many. Can it not recognize what type of control it is if I have changed the name?
Dim ctl As Control
For Each ctl In Me.Controls
ListBox1.Items.Add(ctl.Name)
If TypeOf ctl Is TextBox Then
MsgBox(ctl.Name)
'validate that it is numeric
If ctl.Text = "" Then
'if not show error and exit sub
MessageBox.Show("Please fill all blanks.")
Exit Sub
End If
End If
Next
I appreciate the help.