Lorsque j'ai utilisé Char.IsNumber
, une erreur s'est produite dans form1.designer.cs
.La signature de méthode ne correspond pas à un gestionnaire d'événements de la zone de texte
Aucune surcharge pour "
textBox1_TextChanged
" correspond délégué '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 –