private void btnsave_Click(object sender, EventArgs e)
{
if (txtfname.Text == "" )
{
MessageBox.Show("Please enter your First Name");
txtfname.Focus();
}
}
I want to validate a textbox such that a person cannot leave it blank nor can they add numbers. Do I have to write an "else if" statement or is there any operator that I can use to put it all in the same if statement.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…