use*_*556 3 c# textbox keypress winforms
我是 WinForms 的初学者,所以我想学习,
如何禁用文本框中的空白按键?
private void TextBox1_KeyPress(object sender, KeyPressEventArgs e)
{
// MyTextBox.Text ...?
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激。
这就是你想要的,禁止所有空格
private void TextBox_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = (e.KeyChar == (char)Keys.Space);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13115 次 |
| 最近记录: |