Clear Multiple TextBoxes in C#.Net


clearMultiTextboxCSharpPIIf you are a beginner in Programming Languages and you’re using, this tutorial will help you minimize your codes and lessen your work. This procedure is to clear all the data in the TextBoxes in a certain Form, for example, when you create a “Registration” Form.


To start with:


Open Microsoft Visual Studio 2008 and create new Windows Form Application. Then do the following design of a Form as shown below.


After that, go to the Solution Explorer, double click the “View Code”  to display the code editor.


Then, create a method for clearing the text in the Textboxes.

 private void clearTxt(Control container)
 //'for each txt as control in this(object).control
 foreach (Control txt in container.Controls)
 //conditioning the txt as control by getting it's type.
 //the type of txt as control must be textbox.
 if (txt is TextBox)
 //if the object(textbox) is present. The result is, the textbox will be cleared.
 txt.Text = "";

 catch(Exception ex)

Go back to the design view, double click the “Clear” button and do the following codes for calling the method of clearing text.

 private void button1_Click(object sender, EventArgs e)
 //call a method for clearing all text in the textbox




For all students who need programmer for your thesis system or anyone who needs a sourcecode in any programming languages. You can contact me @ :

Email –
Mobile No. – 09305235027 – tnt

Facebook Comments
(Visited 87 times, 1 visits today)


  1. De esta manera, cuando estornudaba, tosia corria mis musculos del suelo pelvico no tenian la suficiente tonicidad para retener de manera inconsciente la orina en la vejiga y evitar que tuviera escapes.

  2. You really make it seem really easy with your presentation but I find this matter to be really one thing which I feel I might by no means understand. It kind of feels too complex and extremely broad for me. I am looking forward for your next submit, I’ll try to get the hold of it!


Please enter your comment!
Please enter your name here