标签:sse 数字 splay event backspace hide name space dig
使用TextBox的KeyPress事件
/// <summary> /// 去除非十进制和Backspace和Enter /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if ((e.KeyChar!=8 && !char.IsDigit(e.KeyChar))&&e.KeyChar!=13) { MessageBox.Show("请输入数字","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Information); e.Handled = true; } }
标签:sse 数字 splay event backspace hide name space dig
原文地址:https://www.cnblogs.com/Luck1996/p/11919523.html