Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

System.Windows.Forms.TextBox is a type but used like a variable

$
0
0

In one of my buttons click event I call the following method that clears the textboxes:

private void ClearTextBoxes(Control control)
        {
            foreach (Control c in control.Controls)
            {
                if (c.GetType() == typeof(TextBox))
                {
                    ((TextBox)(c)).Text = string.Empty;
                }
            }
        }

I am receiving the error "System.Windows.Forms.TextBox is a type but used like a variable" on the following line:

ClearTextBoxes(TextBox);


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>