void TextBox_KeyPress(object sender ,KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar) || !Char.IsNumber(e.KeyChar)) { e.Handled = true; // Set l'evenement comme etant completement fini return; } }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionvoid chiffre(System.Windows.Forms.KeyPressEventArgs e) { if (!char.IsDigit(e.KeyChar)) e.Handled = true; }
private void textBox_KeyPress(object sender, KeyPressEventArgs e) { chiffre(e); }
9 juil. 2014 à 02:02
6 mai 2017 à 22:49