Is there a way to clear textboxes at once when they have been renamed as txtFName
, txtMName
etc... They may have variety of names beginning with txt
. Is this possible? Something like
private void btnReset_Click(object sender, EventArgs e)
{
txtFname.Clear();
txtLName.Clear();
txtUsername.Clear();
txtPasswrd.Clear();
/*So many textboxes to be cleared*/
}
to be replaced with
private void ClearTextboxes(object obj)
{
/*codes to clear textboxes*/
}
and then we can call it in the button click event
private void btnReset_Click(object sender, EventArgs e)
{
ClearTextboxes();
txtFname.Focus();
}