当我使用Char.IsNumber
时,它在form1.designer.cs
中创建一个错误。方法签名与文本框事件处理程序不匹配
无过载为 “
textBox1_TextChanged
” 匹配委托 'System.EventHandler
'
private void textBox1_TextChanged(object sender, KeyPressEventArgs e)
{
if (char.IsNumber(e.KeyChar))
{
textBox1.Text = e.KeyChar.ToString();
}
else
{
MessageBox.Show("Char value");
}
}
///////////// Text Box ///////////////
this.textBox1.Location = new System.Drawing.Point(73, 57);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(177, 20);
this.textBox1.TabIndex = 0;
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); // error occurs on this line
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.textchanged.aspx –