Problème d'alarme

corazul333 Messages postés 12 Date d'inscription mardi 10 janvier 2006 Statut Membre Dernière intervention 21 mars 2006 - 15 mars 2006 à 08:42
PhilocheMan Messages postés 55 Date d'inscription jeudi 28 juillet 2005 Statut Membre Dernière intervention 23 mars 2006 - 15 mars 2006 à 12:33
Bonjour,
Voilà j'ai un petit bout de programme avec plein de IF, ce que je voudrai c'est que si aucune des conditions soient remplies label12 affiche l'alarme (Label12 = "a" & " "& "l" & " "&"a" &" "&.......)

Voilà le programme :

If Text2.Text > 0 Then
If Label11 > Text2.Text Then
'calcul du nombre de remplissage par jour
Label22 = 1 / Label11
'calcul du nombre de remplissage pour un mois
Label24 = 30 / Label11
'calcul du nombre de remplissage pour un an
Label26 = 365 / Label11
'CALCUL DE LA QUANTITE DE LIQUIDE
Label16 = Text3 * Label22
Label18 = Text3 * Label24
Label20 = Text3 * Label26
End If
End If


If Text2 > 0 Then
If Label11 = Text2 Then
If Label9 > Text1 Then
If Label32 > Text5 Then
Label22 = 1 / Label11
Label24 = 30 / Label11
Label26 = 365 / Label11
Label16 = Text3 * Label22
Label18 = Text3 * Label24
Label20 = Text3 * Label26
End If
End If
End If
End If


If Label11 > 0 Then
If Text2.Text = 0 Then
Label22 = 1 / Label11
Label24 = 30 / Label11
Label26 = 365 / Label11

Label16 = Text3 * Label22
Label18 = Text3 * Label24
Label20 = Text3 * Label26
End If
End If
'FAIRE LES OPERATIONS SUIVANTES SI JOURS=0 ET SI L'INTERVALLE DE REMPLISSAGE EST PLUS GRAND
'QUE CELUI ENTRE PAR L'UTILISATEUR
If Text2 = 0 Then
If Label11 = 0 Then
If Label9 > Text1 Then
If Label32 > Text5 Then
'conversion de l'intervalle calculé en secondes
converh = Label9 * 3600
convermin = Label32 * 60
sec = Label29
conversion = converh + convermin + sec
'division pour connaître combien il ya de jours dans Conversion
'calcul du nombre de remplissages
divi = conversion / 86400
Label22 = 1 / divi
Label24 = 30 / divi
Label26 = 365 / divi

'CALCUL DE LA QUANTITE DE LIQUIDE
Label16 = Text3 * Label22
Label18 = Text3 * Label24
Label20 = Text3 * Label26
End If
End If
End If


End If

Si aucune des conditions précédentes ont été remplies je voudrai à ce moment là faire apparaître l'alarme dans le label12.
En espérant avoir été asser clair.Merci

2 réponses

jannoman Messages postés 256 Date d'inscription jeudi 17 avril 2003 Statut Membre Dernière intervention 20 février 2008 1
15 mars 2006 à 08:47
voici une structure :


if ... then


...


elseif ... then


...


elseif ... then


...


else


...


end if

autre solution :
dim condition as boolean
condition = false
dans chaque test, en plus de faire des opérations, tu fais condition = true

et tout a la fin, tu fais
if not condition then (code alarme)

A+.
Thomas.
0
PhilocheMan Messages postés 55 Date d'inscription jeudi 28 juillet 2005 Statut Membre Dernière intervention 23 mars 2006 1
15 mars 2006 à 12:33
Salut,
Tu peux aussi utiliser l'opérateur logique AND pour vérifier qu'aucune condition n'est remplie :
if (condition1 AND condition2 AND condition3) then
label12 = "ALARME"
else
label12 = vbnullstring
endif
0
Rejoignez-nous