Problème de calcules VB6 , aidez moi svp .

Résolu
corentin19 Messages postés 2 Date d'inscription   Statut Membre Dernière intervention   -  
bokhabrine Messages postés 26 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour, je vous expose mon problème j'ai créer une genre de calculatrice en vb6 avec des chiffre a virgule qui une fois le calcule fait s'affiche dans une texte box mais voici mon problème il fait le calcule mais n'affiche pas les chiffre après la virgule merci de me dire si vous savez le problème voici le code sources :
Dim op As String
Dim num1 As Integer
Dim num2 As Integer

Private Sub cmdADD_Click()
num1 = screen.Text
screen.Text = ""
op = "+"

End Sub

Private Sub cmdCLEAR_Click()
screen.Text = ""
End Sub

Private Sub cmdEQUALS_Click()
num2 = screen.Text
If op = "+" Then
screen.Text = num1 + num2
End If
End Sub

Private Sub Command1_Click()
screen.Text = screen.Text & "3,15"
End Sub

Private Sub Command2_Click()
screen.Text = screen.Text & "7,95"
End Sub

Private Sub Command4_Click()
screen.Text = screen.Text & "2,30"
End Sub

Private Sub Command5_Click()
screen.Text = screen.Text & "8"
End Sub

Private Sub Command6_Click()
screen.Text = screen.Text & "6,30"
End Sub

Private Sub Command7_Click()
screen.Text = screen.Text & "9,45"
End Sub

Private Sub Command8_Click()
screen.Text = screen.Text & "12,6"
End Sub

Private Sub Command9_Click()
screen.Text = screen.Text & "15,9"
End Sub





A voir également:

4 réponses

bokhabrine Messages postés 26 Date d'inscription   Statut Membre Dernière intervention   4
 
Bonsoir corentin19
ton problème c'est que tu définie des variable ""Integer"": par contre tu doit le définie en Double alors ton code va être :

Dim num1 As Double
Dim num2 As Double

Bon chance !!
0
corentin19 Messages postés 2 Date d'inscription   Statut Membre Dernière intervention  
 
Merci a toi , sa marche :)
0
informaticienSAP Messages postés 119 Date d'inscription   Statut Membre Dernière intervention   20
 
.
0
bokhabrine Messages postés 26 Date d'inscription   Statut Membre Dernière intervention   4
 
tu peux mettre au lieux du Double Single à essai :

Dim num1 As Single
Dim num2 As Single
0