當我使用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 –