Disable white space on key press in textbox
13,922
that's what you want, disallows all spaces
private void TextBox_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = (e.KeyChar == (char)Keys.Space);
}
Author by
Admin
Updated on June 05, 2022Comments
-
Admin almost 2 years
I am beginner in WinForms so i would like to learn that,
How can i disable white space keypress in textbox?
private void TextBox1_KeyPress(object sender, KeyPressEventArgs e) { // MyTextBox.Text ...? }
Any help will be appreciated.