Probleme sur calculatrice vba
evolaine
-
lermite222 Messages postés 9042 Statut Contributeur -
lermite222 Messages postés 9042 Statut Contributeur -
Bonjour,
je sais que c'est un sujet que vous avez du voir et revoir mais meme en cherchant partout je ne vois pas ce qui fait que dans mon programme le resultat est toujours de 0
si vous pouviez m'aider....
voila mon code
Private Sub numero0_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "0"
End Sub
Private Sub numero1_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "1"
End Sub
Private Sub numero2_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "2"
End Sub
Private Sub numero3_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "3"
End Sub
Private Sub numero4_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "4"
End Sub
Private Sub numero5_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "5"
End Sub
Private Sub numero6_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "6"
End Sub
Private Sub numero7_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "7"
End Sub
Private Sub numero8_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "8"
End Sub
Private Sub numero9_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "9"
End Sub
Private Sub addition_Click()
Dim nombre1 As Single
Dim nombre2 As Single
Dim resultat As Single
Dim operation As String
nombre1 = Val(TextBox_Operations.Text)
TextBox_Operations.Text = ""
operation = "+"
End Sub
Private Sub soustraction_Click()
Dim nombre1 As Single
Dim nombre2 As Single
Dim resultat As Single
Dim operation As String
nombre1 = Val(TextBox_Operations.Text)
TextBox_Operations.Text = ""
operation = "-"
End Sub
Private Sub multiplication_Click()
Dim nombre1 As Single
Dim nombre2 As Single
Dim resultat As Single
Dim operation As String
nombre1 = Val(TextBox_Operations.Text)
TextBox_Operations.Text = ""
operation = "*"
End Sub
Private Sub division_Click()
Dim nombre1 As Single
Dim nombre2 As Single
Dim resultat As Single
Dim operation As String
nombre1 = Val(TextBox_Operations.Text)
TextBox_Operations.Text = ""
operation = "/"
End Sub
Private Sub point_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "."
End Sub
Private Sub reinitialiser_Click()
TextBox_Operations.Text = ""
End Sub
Private Sub resultat_Click()
Dim nombre1 As Single
Dim nombre2 As Single
Dim resultat As Single
Dim operation As String
nombre2 = Val(TextBox_Operations.Text)
If operation = "+" Then
resultat = nombre1 + nombre2
End If
If operation = "-" Then
resultat = nombre1 - nombre2
End If
If operation = "*" Then
resultat = nombre1 * nombre2
End If
If operation = "/" Then
resultat = nombre1 / nombre2
End If
TextBox_Operations.Text = resultat
End Sub
je sais que c'est un sujet que vous avez du voir et revoir mais meme en cherchant partout je ne vois pas ce qui fait que dans mon programme le resultat est toujours de 0
si vous pouviez m'aider....
voila mon code
Private Sub numero0_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "0"
End Sub
Private Sub numero1_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "1"
End Sub
Private Sub numero2_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "2"
End Sub
Private Sub numero3_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "3"
End Sub
Private Sub numero4_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "4"
End Sub
Private Sub numero5_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "5"
End Sub
Private Sub numero6_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "6"
End Sub
Private Sub numero7_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "7"
End Sub
Private Sub numero8_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "8"
End Sub
Private Sub numero9_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "9"
End Sub
Private Sub addition_Click()
Dim nombre1 As Single
Dim nombre2 As Single
Dim resultat As Single
Dim operation As String
nombre1 = Val(TextBox_Operations.Text)
TextBox_Operations.Text = ""
operation = "+"
End Sub
Private Sub soustraction_Click()
Dim nombre1 As Single
Dim nombre2 As Single
Dim resultat As Single
Dim operation As String
nombre1 = Val(TextBox_Operations.Text)
TextBox_Operations.Text = ""
operation = "-"
End Sub
Private Sub multiplication_Click()
Dim nombre1 As Single
Dim nombre2 As Single
Dim resultat As Single
Dim operation As String
nombre1 = Val(TextBox_Operations.Text)
TextBox_Operations.Text = ""
operation = "*"
End Sub
Private Sub division_Click()
Dim nombre1 As Single
Dim nombre2 As Single
Dim resultat As Single
Dim operation As String
nombre1 = Val(TextBox_Operations.Text)
TextBox_Operations.Text = ""
operation = "/"
End Sub
Private Sub point_Click()
TextBox_Operations.Text = TextBox_Operations.Text & "."
End Sub
Private Sub reinitialiser_Click()
TextBox_Operations.Text = ""
End Sub
Private Sub resultat_Click()
Dim nombre1 As Single
Dim nombre2 As Single
Dim resultat As Single
Dim operation As String
nombre2 = Val(TextBox_Operations.Text)
If operation = "+" Then
resultat = nombre1 + nombre2
End If
If operation = "-" Then
resultat = nombre1 - nombre2
End If
If operation = "*" Then
resultat = nombre1 * nombre2
End If
If operation = "/" Then
resultat = nombre1 / nombre2
End If
TextBox_Operations.Text = resultat
End Sub
A voir également:
- Probleme sur calculatrice vba
- Calculatrice gratuit - Télécharger - Calcul & Conversion
- Comment calculer la moyenne sur excel - Guide
- Installer calculatrice sur mon portable - Télécharger - Calcul & Conversion
- Ma-calculatrice - Télécharger - Calcul & Conversion
- Touche puissance sur calculatrice casio graph 35+e - Forum calculatrices