| comment faire une calculatrice avec vb par Aymen |
vendredi 17 juin 2005 à 16:48:34 |
tu cres un frame avec un groupe de bouton pour les chiffres
et un autre pour les oprations un venement sur appui bouton va inscrire la fin d'une zone texte le chiffre correspondant au bouton press l'appui sur une touche opration va librer l'opration en cours et nourrir un compteur de rsultat intercalaire l'appui sur gal vide tout et affiche rsultat elleestpasbelle,lavie? |
vous voulez pas kon vous ponde votre programme en entier pdt que vous y tes !!!!
rflchissez un peu votre problme avant de poster vos messages!! on vous aidera si vous bloquez sur une partie de votre code !!!! bon courage tony |
comment faire un calculatrice |
|
Dim S1 As Double '2me operande
Dim S2 As Double '1er operande Dim Oper As Integer 'indique la nature de l'operation a faire.On en aura besoin dans le Egal_Click() Dim Oper2 As Boolean 'Indique s'il y'a 2 operateurs ou 1 seul Dim Xbase As Integer 'a c'est pour le boutton + Private Sub Add_Click() Oper = 1 If Oper2 = False Then S2 = S1 S1 = 0 Oper2 = True End If End Sub 'a c'est pour le boutton 1 Private Sub B1_Click() S1 = S1 * 10 + 1 Val.Text = S1 End Sub vous de jouer maintenant |
ben jvous conseil ce site et vous trouverez tout dont vous av besoin et la prochaine il faut etre capabl tt seul voila le site : www.vbfrance.com/gma/calculatrice |
Ca fonctionne avec VBA ??? |
svp si vous pourriez m'aider pour creer un programme window en VB(calculatrice) ca ser sympa de votre part et marci d'avance |
Voici le code d'une calculatrice ke jai cre mais apre c les command originale ke jai utiliser jai pa changer le caption vous pouver cre une calculatrice avec se code je veu dire le meme mais fai attention les buttons doient etre les meme :)
command1 c'est le bouton 1 remarque: byteoperation = 0 sa veu dire ona pa encore click a aucune operation + - * ou / command2 c'est le bouton 2 byteoperation = 1 veu dire kona click sur une operation typeoperation = 1 ca veu dire c loperation + ...................................... typeoperation = 2 c loperation - typeoperation= 3 c * et typeoperation=4 c / ................................... ....................................... .................................... ..................................... ..................................... ....................................... command10 c'est le bouton 0 ----------------------------------------- command11 c'est le boutton C (effacer) command12 c'est le button (+) command13 c'est le button (-) command14 c'est le button (*) command15 c'est le button (/) command16 c'est le button (=) ------------------------------------------------------------------------------------------------------------ (voici le code) Dim byteoperation As Byte Dim typeoperation As Byte Dim nbr1 As Double Dim nbr2 As Double Dim nbr3 As Double Private Sub Command1_Click() If byteoperation = 0 Then Text1.Text = Text1.Text + Str(1) Else Text1.Text = Str(1) byteoperation = 0 End If End Sub Private Sub Command10_Click() If byteoperation = 0 Then Text1.Text = Text1.Text + Str(0) Else Text1.Text = Str(0) byteoperation = 0 End If End Sub Private Sub Command11_Click() Text1.Text = "" End Sub Private Sub Command12_Click() byteoperation = 1 typeoperation = 1 nbr1 = Text1.Text End Sub Private Sub Command13_Click() byteoperation = 1 typeoperation = 2 nbr1 = Text1.Text End Sub Private Sub Command14_Click() byteoperation = 1 typeoperation = 3 nbr1 = Text1.Text End Sub Private Sub Command15_Click() byteoperation = 1 typeoperation = 4 nbr1 = Text1.Text End Sub Private Sub Command16_Click() nbr2 = Text1.Text If typeoperation = 1 Then nbr3 = nbr1 + nbr2 Text1.Text = Val(nbr3) End If nbr2 = Text1.Text If typeoperation = 2 Then nbr3 = nbr1 - nbr2 Text1.Text = Val(nbr3) End If nbr2 = Text1.Text If typeoperation = 3 Then nbr3 = nbr1 * nbr2 Text1.Text = Val(nbr3) End If nbr2 = Text1.Text If typeoperation = 4 Then nbr3 = nbr1 / nbr2 Text1.Text = Val(nbr3) End If End Sub Private Sub Command2_Click() If byteoperation = 0 Then Text1.Text = Text1.Text + Str(2) Else Text1.Text = Str(2) byteoperation = 0 End If End Sub Private Sub Command3_Click() If byteoperation = 0 Then Text1.Text = Text1.Text + Str(3) Else Text1.Text = Str(3) byteoperation = 0 End If End Sub Private Sub Command4_Click() If byteoperation = 0 Then Text1.Text = Text1.Text + Str(4) Else Text1.Text = Str(4) byteoperation = 0 End If End Sub Private Sub Command5_Click() If byteoperation = 0 Then Text1.Text = Text1.Text + Str(5) Else Text1.Text = Str(6) byteoperation = 0 End If End Sub Private Sub Command6_Click() If byteoperation = 0 Then Text1.Text = Text1.Text + Str(6) Else Text1.Text = Str(6) byteoperation = 0 End If End Sub Private Sub Command7_Click() If byteoperation = 0 Then Text1.Text = Text1.Text + Str(7) Else Text1.Text = Str(7) byteoperation = 0 End If End Sub Private Sub Command8_Click() If byteoperation = 0 Then Text1.Text = Text1.Text + Str(8) Else Text1.Text = Str(8) byteoperation = 0 End If End Sub Private Sub Command9_Click() If byteoperation = 0 Then Text1.Text = Text1.Text + Str(9) Else Text1.Text = Str(9) byteoperation = 0 End If End Sub |
| 12/04 05h00 | VBA calculatrice | Programmation | 12/04 22h45 | 3 |
| 28/03 00h41 | cration d'une calculatrice en vb.net | Programmation | 24/06 21h58 | 2 |
| 23/12 12h29 | [VB6] Calculatrice | Programmation | 30/01 15h18 | 3 |
| 17/08 13h47 | VB:interface graphique d'une calculatrice | Programmation | 30/04 13h05 | 6 |