[Solved] How can i clear multiple text boxes when backspace is pressed?


Try this:

txtUser.KeyPress += ClearTextboxes;
txtPass.KeyPress += ClearTextboxes;

private void ClearTextboxes(object sender, KeyPressEventArgs e)
{
    if (e.KeyCode == Keys.Back) 
    {
        (TextBox)sender.Text = string.Empty();
    }
}

solved How can i clear multiple text boxes when backspace is pressed?