VB.net clearing multiple textboxes using a loop

SteveOOOsw

n00b
Joined
Dec 3, 2005
Messages
19
Is there a way to clear multiple textboxes using a loop? Somthing along the lines of

Code:
For Each tb As TextBox In Me
    tb.Text = ""
Next
 
Sure. But, why do you have so many textboxes?
 
In C#, you'd do

Code:
foreach (Control c in Controls)
{
    TextBox tb = c as TextBox;
    if (tb != null)
        tb.Text = String.Empty;
}

Not sure if that helps though. For Windows Forms, you have a container called Controls that holds all the controls for the Windows Form.
 
Back
Top