If you are a beginner in Programming Languages and you’re using C#.net, 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 = "";
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 – [email protected]
Mobile No. – 09305235027 – tnt