B
Brett Romero
I'd like to loop through all text boxes on a winform and check if they
are empty.
private bool emptyTextBoxes()
{
bool isEmpty = true;
foreach(Control ctl in Controls)
{
if (typeof(ctl) == TextBox) //error here
if(ctl.Text != "")
isEmpty = false;
}
return isEmpty
}
I get this error:
The type or namespace name 'ctl' could not be found (are you missing a
using directive or an assembly reference?)
ctl is a typeof Control and I want to make sure it is a TextBox. Why
is this wrong?
Thanks,
Brett
are empty.
private bool emptyTextBoxes()
{
bool isEmpty = true;
foreach(Control ctl in Controls)
{
if (typeof(ctl) == TextBox) //error here
if(ctl.Text != "")
isEmpty = false;
}
return isEmpty
}
I get this error:
The type or namespace name 'ctl' could not be found (are you missing a
using directive or an assembly reference?)
ctl is a typeof Control and I want to make sure it is a TextBox. Why
is this wrong?
Thanks,
Brett