Keypress

1217meyrin Messages postés 159 Date d'inscription lundi 5 avril 2004 Statut Membre Dernière intervention 6 février 2007 - 8 janv. 2007 à 17:03
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 - 8 janv. 2007 à 19:10
Bonjour,


j'ai un prob. avec l'évènement keypress d'une textbox.


lorsque je met un chiffre dans cette textbox, il doit renvoyer ce chiffre dans une autre textbox, mais il y a un temps de retard. il faut taper 2 fois le meme chiffre pour que ca marche? que faire?

7 réponses

cs_casy Messages postés 7741 Date d'inscription mercredi 1 septembre 2004 Statut Membre Dernière intervention 24 septembre 2014 40
8 janv. 2007 à 17:10
ben sans ton code on va pas t'aider beaucoup

---- Sevyc64  (alias Casy) ----<hr size="2" width="100%" /># LE PARTAGE EST NOTRE FORCE #
0
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
8 janv. 2007 à 17:12
Salut,
Essaye cela :

Private Sub Text1_KeyPress(KeyAscii As Integer)
          'Autorisation de la touche return
           If KeyAscii = 13 Then
           Text2.Text = Text1.Text
           End If
  End Sub


A+
Exploreur
0
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
8 janv. 2007 à 17:15
Ce petit bout de code est le "standard", mais comme dit Casy, faudrait voir ton code qui pose problème.


A+


Exploreur
0
1217meyrin Messages postés 159 Date d'inscription lundi 5 avril 2004 Statut Membre Dernière intervention 6 février 2007
8 janv. 2007 à 17:16
merci, mais en fait c'est plus compliqué. quand je saisi un chiffre dans la textbox 1, il y a un calcul qui se fait en fonction de ce chiffre et le résultat doit etre mis dans la textbox 2. il s'agit d'une moyenne
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
8 janv. 2007 à 17:23
Pour comprendre ton problème, comme dit Casy, montre nous ton code,comment tu passe ta moyenne à ton TextBox2.
A+
Exploreur


 
0
1217meyrin Messages postés 159 Date d'inscription lundi 5 avril 2004 Statut Membre Dernière intervention 6 février 2007
8 janv. 2007 à 17:23
voici le code:
dès que l'évènement keypress est déclanché, j'écrit dans un .ini le chiffre et je rappel une procédure qui calcul une moyenne en fonction du chiffre saisi. c'est là qu'il y a un temps de retard.
Private

Sub coefficient1_KeyPress(
ByVal sender
As
Object,
ByVal e
As System.Windows.Forms.KeyPressEventArgs)
Handles coefficient1.KeyPress

If IsNumeric(e.KeyChar)
Or e.KeyChar = "."
Thene.Handled =

False

Elsee.Handled =

True

End
If

Dim objIniFile
As
New IniFile(fichier.Text)objIniFile.WriteString("coefficients", "coefn°1", coefficient1.Text)

pr1_1.Invoke(

New System.EventHandler(
AddressOf pr1_1_TextChanged))
'rappele la procedure pr1_1textchanged
0
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
8 janv. 2007 à 19:10
Bon soit je suis bidon(c'est possible ), soit, j'ai rien compris  c'est presque sur, dans ton post tu nous dit :lorsque je met un chiffre dans cette textbox, il doit renvoyer ce chiffre dans une autre textboxpour ma part c'est text2.text text1.text, alors dans la propriéte Text1.Change tu mets donc text2.text text1.text
A+
Exploreur
0
Rejoignez-nous