Thanos_the_yopper
Messages postés309Date d'inscriptionvendredi 9 janvier 2004StatutMembreDernière intervention 5 mars 2009
-
9 juin 2004 à 14:38
diablorosso
Messages postés3Date d'inscriptionvendredi 17 décembre 2004StatutMembreDernière intervention29 mars 2005
-
20 déc. 2004 à 10:47
j'aurais voulu faire des controles de saisies (genre : que des entier, que des réels, que du texte sans autre caractère que des lettres ou des chiffres, ...)
y'a-t-il une bonne méthode pour faire ça ?
merci d'avance ^^
sinon, pour controler qu'on a bien une date ou une heure, y'a des fonctions spéciales ou faut les créer soit même en se servant des expressions régulières ?
crack_xp
Messages postés91Date d'inscriptionsamedi 28 février 2004StatutMembreDernière intervention25 janvier 2007 9 juin 2004 à 15:54
ceci pourra t'aider // Boolean flag used to determine when a character other than a number is entered.
private bool nonNumberEntered = false;
// Handle the KeyDown event to determine the type of character entered into the control.
private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
// Initialize the flag to false.
nonNumberEntered = false;
// Determine whether the keystroke is a number from the top of the keyboard.
if (e.KeyCode < Keys.D0 || e.KeyCode > Keys.D9)
{
// Determine whether the keystroke is a number from the keypad.
if (e.KeyCode < Keys.NumPad0 || e.KeyCode > Keys.NumPad9)
{
// Determine whether the keystroke is a backspace.
if(e.KeyCode != Keys.Back)
{
// A non-numerical keystroke was pressed.
// Set the flag to true and evaluate in KeyPress event.
nonNumberEntered = true;
}
}
}
}
// This event occurs after the KeyDown event and can be used to prevent
// characters from entering the control.
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
// Check for the flag being set in the KeyDown event.
if (nonNumberEntered == true)
{
// Stop the character from being entered into the control since it is non-numerical.
e.Handled = true;
}
}
diablorosso
Messages postés3Date d'inscriptionvendredi 17 décembre 2004StatutMembreDernière intervention29 mars 2005 20 déc. 2004 à 10:47
salut à tous!
je travaille sur une application Quizz.je voudrais que chaque fois que la touche "F1" est appyuée,mon compteur soit incrémenté de 1.
merci d'avance