cette calculatrice est mon premier programme donc elle est faite avec des truk simple (if then ...).
la source est lourde mais facille a comprendre enfin ... je croi.
Source / Exemple :
Private Sub Command1_Click()
If Text1 <> "" Then Text1 = Text1 * 10 + 7
If Text1 = "" Then Text1 = 7
End Sub
Private Sub Command10_Click()
If Text1 <> "" Then Text1 = Text1 * 10
If Text1 = "" Then Text1 = 0
End Sub
Private Sub Command11_Click()
If Text2 = "" Then
Text2 = Text1
Text6 = "+"
End If
If Text3 = "" And Text2 <> Text1 Then
Text3 = Text1
Text7 = "+"
End If
If Text4 = "" And Text3 <> Text1 And Text2 <> Text1 Then
Text4 = Text1
Text8 = "+"
End If
If Text5 = "" And Text4 <> Text1 And Text3 <> Text1 And Text2 <> Text1 Then Text5 = Text1
Text1 = 0
End Sub
Private Sub Command12_Click()
n1 = 0
n2 = 0
n3 = 0
n4 = 0
If Text3 = "" And Text2 <> Text1 Then Text3 = Text1
If Text4 = "" And Text3 <> Text1 And Text2 <> Text1 Then Text4 = Text1
If Text5 = "" And Text4 <> Text1 And Text3 <> Text1 And Text2 <> Text1 Then Text5 = Text1
If Text6 = "+" Then n1 = 1
If Text6 = "-" Then n1 = 2
If Text6 = "*" Then n1 = 3
If Text6 = "/" Then n1 = 4
If Text7 = "+" Then n2 = 1
If Text7 = "-" Then n2 = 2
If Text7 = "*" Then n2 = 3
If Text7 = "/" Then n2 = 4
If Text8 = "+" Then n3 = 1
If Text8 = "-" Then n3 = 2
If Text8 = "*" Then n3 = 3
If Text8 = "/" Then n3 = 4
If n1 = 1 Then n4 = Text2 - 1 + 1 + Text3
If n1 = 2 Then n4 = Text2 - Text3
If n1 = 3 Then n4 = Text2 * Text3
If n1 = 4 Then n4 = Text2 / Text3
If n2 = 1 Then n4 = n4 - 1 + 1 + Text4
If n2 = 2 Then n4 = n4 - Text4
If n2 = 3 Then n4 = n4 * Text4
If n2 = 4 Then n4 = n4 / Text4
If n3 = 1 Then n4 = n4 - 1 + 1 + Text5
If n3 = 2 Then n4 = n4 - Text5
If n3 = 3 Then n4 = n4 * Text5
If n3 = 4 Then n4 = n4 / Text5
Text1 = n4
End Sub
Private Sub Command13_Click()
If Text2 = "" Then Text2 = Text1
If Text2 = Text1 Then Text6 = "-"
If Text3 = "" And Text2 <> Text1 Then Text3 = Text1
If Text3 = Text1 Then Text7 = "-"
If Text4 = "" And Text3 <> Text1 And Text2 <> Text1 Then Text4 = Text1
If Text4 = Text1 Then Text8 = "-"
If Text5 = "" And Text4 <> Text1 And Text3 <> Text1 And Text2 <> Text1 Then Text5 = Text1
Text1 = 0
End Sub
Private Sub Command14_Click()
If Text2 = "" Then Text2 = Text1
If Text2 = Text1 Then Text6 = "*"
If Text3 = "" And Text2 <> Text1 Then Text3 = Text1
If Text3 = Text1 Then Text7 = "*"
If Text4 = "" And Text3 <> Text1 And Text2 <> Text1 Then Text4 = Text1
If Text4 = Text1 Then Text8 = "*"
If Text5 = "" And Text4 <> Text1 And Text3 <> Text1 And Text2 <> Text1 Then Text5 = Text1
Text1 = 0
End Sub
Private Sub Command15_Click()
If Text2 = "" Then Text2 = Text1
If Text2 = Text1 Then Text6 = "/"
If Text3 = "" And Text2 <> Text1 Then Text3 = Text1
If Text3 = Text1 Then Text7 = "/"
If Text4 = "" And Text3 <> Text1 And Text2 <> Text1 Then Text4 = Text1
If Text4 = Text1 Then Text8 = "/"
If Text5 = "" And Text4 <> Text1 And Text3 <> Text1 And Text2 <> Text1 Then Text5 = Text1
Text1 = 0
End Sub
Private Sub Command16_Click()
End
End Sub
Private Sub Command17_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
End Sub
Private Sub Command2_Click()
If Text1 <> "" Then Text1 = Text1 * 10 + 8
If Text1 = "" Then Text1 = 8
End Sub
Private Sub Command3_Click()
If Text1 <> "" Then Text1 = Text1 * 10 + 9
If Text1 = "" Then Text1 = 9
End Sub
Private Sub Command4_Click()
If Text1 <> "" Then Text1 = Text1 * 10 + 4
If Text1 = "" Then Text1 = 4
End Sub
Private Sub Command5_Click()
If Text1 <> "" Then Text1 = Text1 * 10 + 5
If Text1 = "" Then Text1 = 5
End Sub
Private Sub Command6_Click()
If Text1 <> "" Then Text1 = Text1 * 10 + 6
If Text1 = "" Then Text1 = 6
End Sub
Private Sub Command7_Click()
If Text1 <> "" Then Text1 = Text1 * 10 + 1
If Text1 = "" Then Text1 = 1
End Sub
Private Sub Command8_Click()
If Text1 <> "" Then Text1 = Text1 * 10 + 2
If Text1 = "" Then Text1 = 2
End Sub
Private Sub Command9_Click()
If Text1 <> "" Then Text1 = Text1 * 10 + 3
If Text1 = "" Then Text1 = 3
End Sub
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.