Clearing TextBoxes
Hi ,
I'm new to CSharp,I would like to ask if the METHOD that I planning to develop is feasible.
I trying to develop a class that have a method to clear all the contents of all textbox in a certain "form".
For example:
When I call a method of a Class that clear all the contents of all Text Box in a certain form, it will empty all the textboxes of the form that I would like to.
using System.Windows.Forms;
namespace TestProject
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class CTestForm : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox txtUsername;
private System.ComponentModel.Container
components = null;
private void cmdClear_Click(object sender, System.EventArgs e)
{
/*The code below is the method that I want to
Develop, that the funtionality of the method "ClearTextBox" is to clear all the contents of a textbox control in a certain form "FORM1".*/
[u]
ClassClearControls myControls= new ClassClearControls();
myControls.ClearTextBox(thisForm);
</u>
}
}
}
Please give me some ideas of doing this.Because the problem here is how can I refer to the FORM that it was been passed to a method of a class and do some action of clearing all the contents of of all the textboxes of the FORM that was passed to it.
Human Knowledge Belongs to the World
|