Modif auto d'1 label selon valeur textbox
Résolu
vérokit
Messages postés
68
Date d'inscription
Statut
Membre
Dernière intervention
-
vérokit Messages postés 68 Date d'inscription Statut Membre Dernière intervention -
vérokit Messages postés 68 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
Bonjour à tous,
Je rencontre une petite difficulté dans une des forms de mon application (vb.net). Cette form est constitué de trois textbox (1,2,3) et d'un label. Mon souhait serait de faire apparaître un message dans le label qui diffère selon la valeur de la textbox3. La valeur de la textbox3 est le calcul de l'écart relatif entre la textbox1 et la textbox2. Voici le code concerné :
Private Sub Textbox1_TextChanged () Handles Textbox1.TextChanged
TextBox3.text = (Val(TextBox2.Text) - Val(Textbox1.Text)) / Val(Textbox2.Text) *100 'calcul en temps réel de l'écart
If -0.3 < val(Textbox3.text) < 0.3 then
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE CONFORME"
Else
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE NON CONFORME"
End if
End sub
Private Sub Textbox2_TextChanged () Handles Textbox2.TextChanged
TextBox3.text = (Val(TextBox2.Text) - Val(Textbox1.Text)) / Val(Textbox2.Text) *100 'calcul en temps réel de l'écart
If -0.3 < val(Textbox3.text) < 0.3 then
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE CONFORME"
Else
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE NON CONFORME"
End if
End sub
Le calcul se fait bien, le label affiche le bon texte. Par contre, si l'on modifie les valeurs de textbox1 ou 2, la valeur de l'écart se modifie instantanément mais le label ne se modifie pas.
Quelqu'un a-t-il une idée ??
Merci
Bonjour à tous,
Je rencontre une petite difficulté dans une des forms de mon application (vb.net). Cette form est constitué de trois textbox (1,2,3) et d'un label. Mon souhait serait de faire apparaître un message dans le label qui diffère selon la valeur de la textbox3. La valeur de la textbox3 est le calcul de l'écart relatif entre la textbox1 et la textbox2. Voici le code concerné :
Private Sub Textbox1_TextChanged () Handles Textbox1.TextChanged
TextBox3.text = (Val(TextBox2.Text) - Val(Textbox1.Text)) / Val(Textbox2.Text) *100 'calcul en temps réel de l'écart
If -0.3 < val(Textbox3.text) < 0.3 then
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE CONFORME"
Else
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE NON CONFORME"
End if
End sub
Private Sub Textbox2_TextChanged () Handles Textbox2.TextChanged
TextBox3.text = (Val(TextBox2.Text) - Val(Textbox1.Text)) / Val(Textbox2.Text) *100 'calcul en temps réel de l'écart
If -0.3 < val(Textbox3.text) < 0.3 then
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE CONFORME"
Else
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE NON CONFORME"
End if
End sub
Le calcul se fait bien, le label affiche le bon texte. Par contre, si l'on modifie les valeurs de textbox1 ou 2, la valeur de l'écart se modifie instantanément mais le label ne se modifie pas.
Quelqu'un a-t-il une idée ??
Merci
A voir également:
- Modif auto d'1 label selon valeur textbox
- Label printer logiciel - Télécharger - Outils professionnels
- Ciel auto entrepreneur - Télécharger - Comptabilité & Facturation
- Logiciel gratuit calcul valeur nutritionnelle - Télécharger - Santé & Bien-être
- Excel couleur cellule selon valeur - Guide
- Valeur ascii - Guide
1 réponse
Ca y est, j'ai trouvé la soluce !
Private Sub Textbox1_TextChanged () Handles Textbox1.TextChanged
TextBox3.text = (Val(TextBox2.Text) - Val(Textbox1.Text)) / Val(Textbox2.Text) *100 'calcul en temps réel de l'écart
If -0.3 < val(Textbox3.text) and val(Textbox3.text) < 0.3 then
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE CONFORME"
End if
If -0.3 > val(Textbox3.text) or val(Textbox3.text) > 0.3 then
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE NON CONFORME"
End if
End sub
Private Sub Textbox2_TextChanged () Handles Textbox2.TextChanged
TextBox3.text = (Val(TextBox2.Text) - Val(Textbox1.Text)) / Val(Textbox2.Text) *100 'calcul en temps réel de l'écart
If -0.3 < val(Textbox3.text) and val(Textbox3.text) < 0.3 then
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE CONFORME"
End if
If -0.3 > val(Textbox3.text) or val(Textbox3.text) > 0.3 then
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE NON CONFORME"
End if
End sub
Private Sub Textbox1_TextChanged () Handles Textbox1.TextChanged
TextBox3.text = (Val(TextBox2.Text) - Val(Textbox1.Text)) / Val(Textbox2.Text) *100 'calcul en temps réel de l'écart
If -0.3 < val(Textbox3.text) and val(Textbox3.text) < 0.3 then
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE CONFORME"
End if
If -0.3 > val(Textbox3.text) or val(Textbox3.text) > 0.3 then
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE NON CONFORME"
End if
End sub
Private Sub Textbox2_TextChanged () Handles Textbox2.TextChanged
TextBox3.text = (Val(TextBox2.Text) - Val(Textbox1.Text)) / Val(Textbox2.Text) *100 'calcul en temps réel de l'écart
If -0.3 < val(Textbox3.text) and val(Textbox3.text) < 0.3 then
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE CONFORME"
End if
If -0.3 > val(Textbox3.text) or val(Textbox3.text) > 0.3 then
Label.text = "LE CONVERTISSEUR DE TEMPERATURE EST DECLARE NON CONFORME"
End if
End sub