private void Keypad_Btn_Click(object sender, EventArgs e) { string buttonText = ((Button)sender).Text; if (buttonText == "Delete") { LoginBox.Text = LoginBox.Text.Substring(0, (LoginBox.TextLength - 1)); } else { LoginBox.AppendText(buttonText); if (LoginBox.TextLength == MaxValue) { LoginEmployee(); } } }