begin process at 2012 02 04 14:11:46
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

API

 > CALCULATRICE WINDOWS

CALCULATRICE WINDOWS


 Information sur la source

Note :
7 / 10 - par 3 personnes
7,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :API Classé sous :calculatrice Niveau :Débutant Date de création :31/03/2001 Vu :4 800

Auteur : Neo011001

Ecrire un message privé
Commentaire sur cette source (2)
Ajouter un commentaire et/ou une note

 Description

faites une interface de calculatrice windows standard et insérez ceci:

Source

  • Private signe, retour As Byte
  • Private N1, N2, mem As Single
  • Private sepdec, zero As String
  • Private Sub Form_Load()
  • zero = "0"
  • sepdec = ","
  • txtAfficher.Text = "0,"
  • retour = 1
  • End Sub
  • Private Sub cmdRetour_Click()
  • If txtAfficher.Text <> "0" Then
  • If Len(txtAfficher.Text) = 1 Then
  • txtAfficher.Text = "0,"
  • retour = 1
  • Else
  • txtAfficher.Text = Left(txtAfficher.Text, Len(txtAfficher.Text) - 1)
  • End If
  • End If
  • End Sub
  • Private Sub cmdSigne_Click()
  • txtAfficher.Text = Not (Val(txtAfficher.Text)) - 1
  • retour = 1
  • End Sub
  • Private Sub cmdVirgule_Click()
  • If retour = 0 Then
  • txtAfficher.Text = txtAfficher.Text + sepdec
  • Else
  • txtAfficher.Text = sepdec
  • retour = 0
  • End If
  • End Sub
  • ' Initialisation des commandes de 0 à 9
  • Private Sub cmd0_Click()
  • If retour = 0 Then
  • txtAfficher.Text = txtAfficher.Text + CStr(0)
  • Else
  • txtAfficher.Text = CStr(0)
  • retour = 0
  • End If
  • End Sub
  • Private Sub cmd1_Click()
  • If retour = 0 Then
  • txtAfficher.Text = txtAfficher.Text + CStr(1)
  • Else
  • txtAfficher.Text = CStr(1)
  • retour = 0
  • End If
  • End Sub
  • Private Sub cmd2_Click()
  • If retour = 0 Then
  • txtAfficher.Text = txtAfficher.Text + CStr(2)
  • Else
  • txtAfficher.Text = CStr(2)
  • retour = 0
  • End If
  • End Sub
  • Private Sub cmd3_Click()
  • If retour = 0 Then
  • txtAfficher.Text = txtAfficher.Text + CStr(3)
  • Else
  • txtAfficher.Text = CStr(3)
  • retour = 0
  • End If
  • End Sub
  • Private Sub cmd4_Click()
  • If retour = 0 Then
  • txtAfficher.Text = txtAfficher.Text + CStr(4)
  • Else
  • txtAfficher.Text = CStr(4)
  • retour = 0
  • End If
  • End Sub
  • Private Sub cmd5_Click()
  • If retour = 0 Then
  • txtAfficher.Text = txtAfficher.Text + CStr(5)
  • Else
  • txtAfficher.Text = CStr(5)
  • retour = 0
  • End If
  • End Sub
  • Private Sub cmd6_Click()
  • If retour = 0 Then
  • txtAfficher.Text = txtAfficher.Text + CStr(6)
  • Else
  • txtAfficher.Text = CStr(6)
  • retour = 0
  • End If
  • End Sub
  • Private Sub cmd7_Click()
  • If retour = 0 Then
  • txtAfficher.Text = txtAfficher.Text + CStr(7)
  • Else
  • txtAfficher.Text = CStr(7)
  • retour = 0
  • End If
  • End Sub
  • Private Sub cm8_Click()
  • If retour = 0 Then
  • txtAfficher.Text = txtAfficher.Text + CStr(8)
  • Else
  • txtAfficher.Text = CStr(8)
  • retour = 0
  • End If
  • End Sub
  • Private Sub cmd9_Click()
  • If retour = 0 Then
  • txtAfficher.Text = txtAfficher.Text + CStr(9)
  • Else
  • txtAfficher.Text = CStr(9)
  • retour = 0
  • End If
  • End Sub
  • Private Sub CmdC_Click()
  • txtAfficher.Text = "0,"
  • N1 = 0
  • retour = 1
  • End Sub
  • 'Assignation des valeurs en entrée des opérands
  • Private Sub cmdDivision_Click()
  • N1 = Val(txtAfficher.Text)
  • retour = 1
  • signe = 1
  • End Sub
  • Private Sub cmdProduit_Click()
  • N1 = Val(txtAfficher.Text)
  • retour = 1
  • signe = 2
  • End Sub
  • Private Sub cmdAddition_Click()
  • N1 = Val(txtAfficher.Text)
  • retour = 1
  • signe = 3
  • End Sub
  • Private Sub cmdSoustraction_Click()
  • N1 = Val(txtAfficher.Text)
  • retour = 1
  • signe = 4
  • End Sub
  • ' La sélection de l'opérand
  • Private Sub cmdResultat_Click()
  • N2 = Val(txtAfficher.Text)
  • Dim virgule As Integer
  • Select Case signe
  • Case 1
  • If Val(txtAfficher.Text) <> 0 Then
  • N1 = N1 / N2
  • Else
  • N1 = "Erreur : nombre infini positif."
  • End If
  • Case 2
  • N1 = N1 * N2
  • virgule = InStr(CStr(N1), ",")
  • If virgule = 0 Then
  • zero = CStr(N1)
  • txtAfficher.Text = zero & virgule
  • Else
  • zero = CStr(N1)
  • txtAfficher.Text = zero
  • End If
  • Case 3
  • N1 = N1 + N2
  • virgule = InStr(CStr(N1), ",")
  • If virgule = 0 Then
  • zero = CStr(N1)
  • txtAfficher.Text = zero & virgule
  • Else
  • zero = CStr(N1)
  • txtAfficher.Text = zero
  • End If
  • Case 4
  • N1 = N1 - N2
  • virgule = InStr(CStr(N1), ",")
  • If virgule = 0 Then
  • zero = CStr(N1)
  • txtAfficher.Text = zero & virgule
  • Else
  • zero = CStr(N1)
  • txtAfficher.Text = zero
  • End If
  • End Select
  • txtAfficher.Text = CStr(N1)
  • retour = 1
  • End Sub
  • ' Fractions et racine carré
  • Private Sub cmdSqrt_Click()
  • txtAfficher.Text = Sqr(txtAfficher.Text)
  • retour = 1
  • End Sub
  • Private Sub cmdPourcentage_Click()
  • txtAfficher.Text = Val(txtAfficher.Text) / 100
  • retour = 1
  • End Sub
  • Private Sub cmdFraction_Click()
  • If Val(txtAfficher.Text) = 0 Then
  • txtAfficher.Text = "Erreur : nombre infini positif."
  • retour = 1
  • Else
  • If Val(txtAfficher.Text) <> 0 Then
  • txtAfficher.Text = 1 / CStr(Val(txtAfficher.Text))
  • retour = 1
  • End If
  • End If
  • End Sub
  • ' Gestion des touches mémoires
  • Private Sub cmdMs_Click()
  • mem = Val(txtAfficher.Text)
  • txtMem.Text = "M"
  • retour = 1
  • End Sub
  • Private Sub cmdMr_Click()
  • txtAfficher.Text = mem
  • retour = 1
  • End Sub
  • Private Sub cmdMc_Click()
  • txtMem.Text = ""
  • mem = 0
  • retour = 1
  • End Sub
  • Private Sub cmdM_Click()
  • mem = mem + Val(txtAfficher.Text)
  • retour = 1
  • End Sub
Private signe, retour As Byte
Private N1, N2, mem As Single
Private sepdec, zero As String

Private Sub Form_Load()
zero = "0"
sepdec = ","
txtAfficher.Text = "0,"
retour = 1
End Sub

Private Sub cmdRetour_Click()
If txtAfficher.Text <> "0" Then
    If Len(txtAfficher.Text) = 1 Then
        txtAfficher.Text = "0,"
        retour = 1
    Else
txtAfficher.Text = Left(txtAfficher.Text, Len(txtAfficher.Text) - 1)
End If
End If
End Sub

Private Sub cmdSigne_Click()
txtAfficher.Text = Not (Val(txtAfficher.Text)) - 1
retour = 1
End Sub

Private Sub cmdVirgule_Click()
If retour = 0 Then
   txtAfficher.Text = txtAfficher.Text + sepdec
 Else
   txtAfficher.Text = sepdec
   retour = 0
End If
End Sub
              ' Initialisation des commandes de 0 à 9
Private Sub cmd0_Click()
If retour = 0 Then
   txtAfficher.Text = txtAfficher.Text + CStr(0)
 Else
   txtAfficher.Text = CStr(0)
   retour = 0
End If
End Sub

Private Sub cmd1_Click()
If retour = 0 Then
   txtAfficher.Text = txtAfficher.Text + CStr(1)
 Else
   txtAfficher.Text = CStr(1)
   retour = 0
End If
End Sub

Private Sub cmd2_Click()
If retour = 0 Then
   txtAfficher.Text = txtAfficher.Text + CStr(2)
Else
   txtAfficher.Text = CStr(2)
   retour = 0
   End If
End Sub

Private Sub cmd3_Click()
If retour = 0 Then
   txtAfficher.Text = txtAfficher.Text + CStr(3)
Else
   txtAfficher.Text = CStr(3)
   retour = 0
   End If
End Sub

Private Sub cmd4_Click()
If retour = 0 Then
   txtAfficher.Text = txtAfficher.Text + CStr(4)
Else
   txtAfficher.Text = CStr(4)
   retour = 0
   End If
End Sub

Private Sub cmd5_Click()
If retour = 0 Then
   txtAfficher.Text = txtAfficher.Text + CStr(5)
Else
   txtAfficher.Text = CStr(5)
   retour = 0
   End If
End Sub

Private Sub cmd6_Click()
If retour = 0 Then
   txtAfficher.Text = txtAfficher.Text + CStr(6)
Else
   txtAfficher.Text = CStr(6)
   retour = 0
   End If
End Sub

Private Sub cmd7_Click()
If retour = 0 Then
   txtAfficher.Text = txtAfficher.Text + CStr(7)
Else
   txtAfficher.Text = CStr(7)
   retour = 0
   End If
End Sub

Private Sub cm8_Click()
If retour = 0 Then
   txtAfficher.Text = txtAfficher.Text + CStr(8)
Else
   txtAfficher.Text = CStr(8)
   retour = 0
   End If
End Sub

Private Sub cmd9_Click()
If retour = 0 Then
   txtAfficher.Text = txtAfficher.Text + CStr(9)
Else
   txtAfficher.Text = CStr(9)
   retour = 0
   End If
End Sub

Private Sub CmdC_Click()
txtAfficher.Text = "0,"
N1 = 0
retour = 1
End Sub
    'Assignation des valeurs en entrée des opérands
Private Sub cmdDivision_Click()
N1 = Val(txtAfficher.Text)
retour = 1
signe = 1
End Sub

Private Sub cmdProduit_Click()
N1 = Val(txtAfficher.Text)
retour = 1
signe = 2
End Sub

Private Sub cmdAddition_Click()
N1 = Val(txtAfficher.Text)
retour = 1
signe = 3
End Sub

Private Sub cmdSoustraction_Click()
N1 = Val(txtAfficher.Text)
retour = 1
signe = 4
End Sub
                ' La sélection de l'opérand
Private Sub cmdResultat_Click()
N2 = Val(txtAfficher.Text)
Dim virgule As Integer
Select Case signe
            Case 1
             If Val(txtAfficher.Text) <> 0 Then
               N1 = N1 / N2
             Else
               N1 = "Erreur : nombre infini positif."
             End If
            Case 2
            N1 = N1 * N2
            virgule = InStr(CStr(N1), ",")
            If virgule = 0 Then
            zero = CStr(N1)
            txtAfficher.Text = zero & virgule
            Else
            zero = CStr(N1)
            txtAfficher.Text = zero
            End If
            
            Case 3
            N1 = N1 + N2
            virgule = InStr(CStr(N1), ",")
            If virgule = 0 Then
            zero = CStr(N1)
            txtAfficher.Text = zero & virgule
            Else
            zero = CStr(N1)
            txtAfficher.Text = zero
            End If
            
            Case 4
            N1 = N1 - N2
            virgule = InStr(CStr(N1), ",")
            If virgule = 0 Then
            zero = CStr(N1)
            txtAfficher.Text = zero & virgule
            Else
            zero = CStr(N1)
            txtAfficher.Text = zero
            End If
            
       End Select
txtAfficher.Text = CStr(N1)
retour = 1
End Sub
                 ' Fractions et racine carré
Private Sub cmdSqrt_Click()
txtAfficher.Text = Sqr(txtAfficher.Text)
retour = 1
End Sub

Private Sub cmdPourcentage_Click()
txtAfficher.Text = Val(txtAfficher.Text) / 100
retour = 1
End Sub

Private Sub cmdFraction_Click()

    If Val(txtAfficher.Text) = 0 Then
    txtAfficher.Text = "Erreur : nombre infini positif."
    retour = 1
    Else
    If Val(txtAfficher.Text) <> 0 Then
    txtAfficher.Text = 1 / CStr(Val(txtAfficher.Text))
retour = 1
End If
End If
End Sub
              ' Gestion des touches mémoires
Private Sub cmdMs_Click()
mem = Val(txtAfficher.Text)
txtMem.Text = "M"
retour = 1
End Sub

Private Sub cmdMr_Click()
txtAfficher.Text = mem
retour = 1
End Sub

Private Sub cmdMc_Click()
txtMem.Text = ""
mem = 0
retour = 1
End Sub

Private Sub cmdM_Click()
mem = mem + Val(txtAfficher.Text)
retour = 1
End Sub


 



 Sources de la même categorie

Source avec Zip Source .NET (Dotnet) .NET DEPENDENCY VIEWER : ARBRE DES DÉPENDANCES D'UN ASSEMBLY... par ShareVB
Source avec Zip Source .NET (Dotnet) UTILITAIRE SKYDRIVE par MasterShadows
Source avec Zip ROTATION RAPIDE D'IMAGE par trex70
Source avec Zip Source avec une capture ENUMERATION DES PORTS TCP ET IDENTIFCATION DU PROCESS (PID) ... par Renfield
Source avec Zip Source avec une capture MOUSE SPEED AND WEIGHT : RETOUR DE FORCE VIRTUEL ! par ScSami

 Sources en rapport avec celle ci

Source avec Zip CALCUL D'APRES UN TEXTBOX par lololilizozo
Source avec Zip Source avec une capture CALCULATRICE VBSCRIPT par nathansecret
Source avec Zip Source avec une capture UNE VRAIE CALCULATRICE : ÉCRITURE 2D : ON MARQUE LA LIGNE EN... par neamar
Source avec Zip Source avec une capture CALCULETTE DE METIER par BFR
Source avec Zip Source avec une capture CALCULATRICE NOTES DE FRAIS par natou76

Commentaires et avis

Commentaire de ama le 11/03/2003 02:01:48

c ets quoi  Val(txtAfficher.Text)  je veux surtout savoir le VAl tu le sors d ou?

Commentaire de GabrielT le 20/05/2003 03:20:48

Val(txtAfficher.Text) le val signifit la valeur de txtAfficher.Text

 Ajouter un commentaire


Discussions en rapport avec ce code source dans le forum

calculatrice [ par yallah ] Quelqu'un à t-il un script pour créer une calculatrice?Merci calculatrice [ par petit prince ] j'ai un problème avec la virgule et le zéro.je n'arrive pas à mettre de 0 après la virgule Calculatrice : Additon ??? [ par Jeff ] Bonjour, je recherche comment je doit faire pour pouvoir faire un addition.Je doit faire une calculatrice (comme celle de Windows). Merci à l'avance.. Comment utiliser la fonction KeyDown ??? [ par Jeff ] Bonjour... Je me répète mais la réponse que j'ai eu ne fonctionne touours pas... J'avais écrit que je n'étais pas capable d'utiliser la fonction KeyDo Appel calculatrice à partir OCX [ par jeanyves ] Je souhaite appeler une calculatrice par un dblclick.Et ce, dans un OCX sur lequel je suis entrain de travailler (et de ramer)Avec la calculatrice Win Creation d'un calculatrice financiere avec VB [ par bebepuff ] Bonjour chers cracks,Je suis un etudiant de l'universite Laval en actuariat et notre cher professeur de Visual Basic nous a donne un travail consistan ouvrir si pas ouvert [ par nerakcire ] bonjours, je demande de l'aide car je cherche a réaliser un programme en VB6, qui réalise:l'ouverture d'un executable (exemple: calculatrice), que si setfocus [ par chrisou31 ] bonjour a tousje fais une petite calculatrice pour me roder peperelors du demarrage de l'appli, je fais un form.show suivi d'un form.setfocus dans le Ouverture de la calculatrice depuis Word [ par congelator ] Salut à tous,J'essaie d'attribuer, à une icone dans Word, l'ouverture de la calculatrice qui se trouve sous C:\WINDOWS\CALC.EXE Est-ce possible avec V Aide pour la realisation d'une calculette [ par KaiserGringos ] Bonjour !Je debute en programmation et on m'as demander de realiser une calculatrice convertisseur d'euro a l'ecole. Voila mon probleme, j'aimerais sa


Nos sponsors


Sondage...

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,827 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales