Bonne solution

levotre123 Messages postés 50 Date d'inscription lundi 2 mars 2009 Statut Membre Dernière intervention 14 mai 2020 - 19 févr. 2010 à 18:14
BunoCS Messages postés 15472 Date d'inscription lundi 11 juillet 2005 Statut Modérateur Dernière intervention 25 mars 2024 - 22 févr. 2010 à 09:24
Salut a tous

Pourrais Je avoir le meme code ci-dessous , mais fois avec swich case ?

private void button1_Click(object sender, EventArgs e)
{
// pictureBox1.InitialImage = Properties.Resources.Load;
}

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar (char )Keys.Enter && textBox1.Text"")
{
e.Handled = true;
MessageBox.Show("Enter a value");
textBox1.Focus();

}
else
if (char.IsDigit (e.KeyChar) == true )
{
e.Handled = true;

MessageBox.Show("Enter a correct value");
textBox1.Text = "";
}
else
if(char.IsPunctuation(e.KeyChar )== true )
{
e.Handled = true;
textBox1.Text = "";
MessageBox.Show("Enter a correct value");


}
else
if (char.IsSymbol(e.KeyChar) == true)
{
e.Handled = true;
textBox1.Text = "";
MessageBox.Show("blablablabla");

}

}

1 réponse

BunoCS Messages postés 15472 Date d'inscription lundi 11 juillet 2005 Statut Modérateur Dernière intervention 25 mars 2024 103
22 févr. 2010 à 09:24
Hello,
Tu pourrais...mais tu perdrais ton temps.



@+
Buno
----------------------------------------
L'urgent est fait, l'impossible est en cours. Pour les miracles, prévoir un délai...
0
Rejoignez-nous