You can restrict the user from entering space in the TextBox
by handling the KeyPress
event
void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = (e.KeyChar == (char)Keys.Space);
}
EDIT
In case space is allowed after entering a character or two , then you should be using
textbox1.Text.TrimStart()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…