My scenario is:
Not allowing spaces at starting position of textbox after enter one or more characters text box allows spaces
Below not applicable to my scenario.
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.Handled = (e.KeyChar == (char)Keys.Space))
{
MessageBox.Show("Spaces are not allowed");
}
}
textBox1.Text.TrimStart()
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…