I want to test all message boxes for null at once

I am trying to test to see if ALLl message boxes are empty all at once without having to write txtTextBox.text="" and to display a message to the user informing the user to enter info to all text boxes

I know how to clear all text boxes with this piece of code.

Dim Contrl As Control

For Each Contrl In frmCustomer.Controls
If (TypeOf Contrl Is TextBox) Then Contrl.Text = ""
Next Contrl

Does anyone have a piece of code I can use to test all or any text boxes at once to see if they are empty?

Thanks a bunch!!!
[587 byte] By [OzzyOsbourne] at [2007-11-17 17:00:17]
# 1 Re: I want to test all message boxes for null at once
Extend your code to check if it is empty:

Dim Contrl As Control

For Each Contrl In frmCustomer.Controls
If (TypeOf Contrl Is TextBox) Then
' Contrl.Text = ""

if (contrl.text = "") then
if (contrl.enabled) then contrl.SetFocus
msgbox contrl.name & " cannot be empty"
exit for
end if

end if
Next Contrl

Good Luck,
-Cool Bizs
coolbiz at 2007-11-10 0:23:06 >