Possible Duplicates:
validating textbox in windows form applications
validating textbox in windows form application
The Event not allowing Any Spaces , But i want Avoid start one or two or three Spaces in text box in windows form application using C#.net
void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = (e.KeyChar == (char)Keys.Space);
}