Operation de devision ne fonctionne ps (vb 6.0)
aloulou007
Messages postés
18
Statut
Membre
-
Yoda -
Yoda -
je fais une alculatrice mais loperation de devision ne fonctionne ps
Private Sub Command1_Click()
If Option1.Value = True Then
Label4 = CInt(Text2.Text) + CInt(Text3.Text)
End If
If Option2.Value = True Then
Label4 = CInt(Text2.Text) - CInt(Text3.Text)
End If
If Option3.Value = True Then
Label4 = CInt(Text2.Text) * CInt(Text3.Text)
End If
If Option4.Value = True Then
If (CInt(Text2.Text) = 0 Or CInt(Text3.Text) = 0) Or (CInt(Text2.Text) = 0 And CInt(Text3.Text) = 0) Then
MsgBox " chifre 1 et 2 doivent etre diff de 0"
Label4 = CInt(Text2.Text) \ CInt(Text3.Text)
End If
End If
End Sub
Private Sub Command1_Click()
If Option1.Value = True Then
Label4 = CInt(Text2.Text) + CInt(Text3.Text)
End If
If Option2.Value = True Then
Label4 = CInt(Text2.Text) - CInt(Text3.Text)
End If
If Option3.Value = True Then
Label4 = CInt(Text2.Text) * CInt(Text3.Text)
End If
If Option4.Value = True Then
If (CInt(Text2.Text) = 0 Or CInt(Text3.Text) = 0) Or (CInt(Text2.Text) = 0 And CInt(Text3.Text) = 0) Then
MsgBox " chifre 1 et 2 doivent etre diff de 0"
Label4 = CInt(Text2.Text) \ CInt(Text3.Text)
End If
End If
End Sub
5 réponses
-
Bonjour,
If Option4.Value = True Then If (CInt(Text2.Text) = 0 Or CInt(Text3.Text) = 0) Or (CInt(Text2.Text) = 0 And CInt(Text3.Text) = 0) Then MsgBox " chifre 1 et 2 doivent etre diff de 0" Else Label4 = CInt(Text2.Text) \ CInt(Text3.Text) End If End If
A+ -
-
g 3 text box en cliquant sur un bouton le minimum saffiche dns un label c quoi le probleme?
Sub minim(x As Integer, y As Integer, min As Integer)
If x < min Then
x = min
End If
If z < min Then
z = min
End If
Label8.Caption = min
End Sub
Private Sub comparer_Click()
Dim nb1 As Integer
Dim nb2 As Integer
Dim nb3 As Integer
nb1 = CInt(Text1.Text)
nb2 = CInt(Text2.Text)
nb3 = CInt(Text3.Text)
Call minim(comparer(nb1, nb2, nb3))
End Sub -
Bonjour,
Une autre façon de faire une calculatrice Voir cette démo
Une approche comme toi, avec deux textbox Projet calculateur
A+
-
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question -
g 3 text box en cliquant sur un bouton le minimum saffiche dns un label c quoi le probleme? !!!!!!!!!!!!!!!!!!!!!!!!
Sub minim(x As Integer, y As Integer, min As Integer)
If x < min Then
x = min
End If
If z < min Then
z = min
End If
Label8.Caption = min
End Sub
Private Sub comparer_Click()
Dim nb1 As Integer
Dim nb2 As Integer
Dim nb3 As Integer
nb1 = CInt(Text1.Text)
nb2 = CInt(Text2.Text)
nb3 = CInt(Text3.Text)
Call minim(comparer(nb1, nb2, nb3))
End Sub-
Bonjour,
Il y a plusieurs problèmes:
1/ la Sub minim() a trois paramètres, x , y et min
et dans le corps de la sub on voit x, z et min
2/ le Call est incorrect, il faut écrire Call minim(nb1,nb2,nb3)
3/ ton raisonnement pour trouver le minimun de trois nombre est faux, je te laisse réfléchir un peu.
A+
-