i want to validate the textbox which only accept letters and spaces how i can validate the textbox want the complete code in C#
How to Validate the TextBox That Only Allows Letters & space
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Bikesh SrivastavaRank #108 · 20.3K reputationPosted Jan 31, 2017, 9:07 AM EST
Sajjad Bhatti40 reputationPosted Jan 31, 2017, 9:22 AM EST
Sajjad Bhatti40 reputationPosted Feb 1, 2017, 3:29 AM EST
Amitesh VermaRank #2,535 · 552 reputationPosted Feb 1, 2017, 12:14 AM EST
private void textBox1_TextChanged(object sender, EventArgs e) { if (!System.Text.RegularExpressions.Regex.IsMatch(textBox1.Text, "^[a-zA-Z]")) { MessageBox.Show("This textbox accepts only alphabetical characters"); textBox1.Text.Remove(textBox1.Text.Length - 1); } }