Commentaire

remagen Messages postés 1 Date d'inscription dimanche 6 novembre 2005 Statut Membre Dernière intervention 6 novembre 2005 - 6 nov. 2005 à 11:55
jpleroisse Messages postés 1788 Date d'inscription mardi 7 novembre 2000 Statut Membre Dernière intervention 11 mars 2006 - 6 nov. 2005 à 14:14
Bonjour tout le monde



Je viens de trouver un petit programme sur ce site concernant une calculatrice simple :

http://www.vbfrance.com/code.aspx?id=5374



Etant donner le novice que je suis j'aimerai avoir un commentaire sur
ce programme et tou particulièrement, l'insertion de la commande
cmd.

Est-il possible d'exécuter dans ce cas ce programme sous MS-DOS ?

De mon coté j'ai essayer d'écrire ce programme à l'aide de Microsoft Acess mais je n'y arrive pas.



Votre aide me sera précieuse.



Merci d'avance

2 réponses

PCPT Messages postés 13272 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 47
6 nov. 2005 à 12:50
salut,
pour l'exemple, "cmd" est juste le début du nom du contrôle. aucun rapport avec COMMAND.COM

maintenant, pour ce genre de question, il est beaucoup plus logique de contacter l'auteur des sources qui t'intriguent.
(IcemanBruno pour ce cas. en plus çà lui fera sans doute plaisir^^)
l'espace "commentaire" est là pour çà.

@+
PCPT [AFCK]
0
jpleroisse Messages postés 1788 Date d'inscription mardi 7 novembre 2000 Statut Membre Dernière intervention 11 mars 2006 27
6 nov. 2005 à 14:14
Bonjour,

Si tu veux faire une calculatrice, utilise Excel

Je vais te donner le code, en l'analysant, tu verras comment placer tes CommandButton et le TextBox sur ton userForm.



Option Explicit

Public N1 As Double

Public N2 As Double

Public N3 As Double

Public Signe As Byte

Public TF As Byte



Private Sub cmd0_Click()

If TF = 0 Then

TextBox1.Text = TextBox1.Text + Str(0)

Else

TextBox1.Text = Str(0)

TF = 0

End If

End Sub



Private Sub cmd1_Click()

If TF = 0 Then

TextBox1.Text = TextBox1.Text + Str(1)

Else

TextBox1.Text = Str(1)

TF = 0

End If

End Sub



Private Sub cmd2_Click()

If TF = 0 Then

TextBox1.Text = TextBox1.Text + Str(2)

Else

TextBox1.Text = Str(2)

TF = 0

End If

End Sub



Private Sub cmd3_Click()

If TF = 0 Then

TextBox1.Text = TextBox1.Text + Str(3)

Else

TextBox1.Text = Str(3)

TF = 0

End If

End Sub



Private Sub cmd4_Click()

If TF = 0 Then

TextBox1.Text = TextBox1.Text + Str(4)

Else

TextBox1.Text = Str(4)

TF = 0

End If

End Sub



Private Sub cmd5_Click()

If TF = 0 Then

TextBox1.Text = TextBox1.Text + Str(5)

Else

TextBox1.Text = Str(5)

TF = 0

End If

End Sub



Private Sub cmd6_Click()

If TF = 0 Then

TextBox1.Text = TextBox1.Text + Str(6)

Else

TextBox1.Text = Str(6)

TF = 0

End If

End Sub



Private Sub cmd7_Click()

If TF = 0 Then

TextBox1.Text = TextBox1.Text + Str(7)

Else

TextBox1.Text = Str(7)

TF = 0

End If

End Sub



Private Sub cmd8_Click()

If TF = 0 Then

TextBox1.Text = TextBox1.Text + Str(8)

Else

TextBox1.Text = Str(8)

TF = 0

End If

End Sub



Private Sub cmd9_Click()

If TF = 0 Then

TextBox1.Text = TextBox1.Text + Str(9)

Else

TextBox1.Text = Str(9)

TF = 0

End If

End Sub



Private Sub cmdClose_Click()

Unload Me

End Sub



Private Sub cmdDiviser_Click()

N1 = Val(TextBox1.Text)

TF = 1

Signe = 1

End Sub



Private Sub cmdEgal_Click()

N2 = Val(TextBox1.Text)

Select Case Signe

Case 1

N3 = N1 / N2

Case 2

N3 = N1 * N2

Case 3

N3 = N1 + N2

Case 4

N3 = N1 - N2

End Select

TextBox1.Text = Str(N3)

TF = 1

End Sub

Private Sub cmdMoins_Click()

N1 = Val(TextBox1.Text)

TF = 1

Signe = 4

End Sub

Private Sub cmdMultiplier_Click()

N1 = Val(TextBox1.Text)

TF = 1

Signe = 2

End Sub

Private Sub cmdPlus_Click()

N1 = Val(TextBox1.Text)

TF = 1

Signe = 3

End Sub

Private Sub cmdPoint_Click()

If TF = 0 Then

TextBox1.Text = TextBox1.Text + "."

Else

TextBox1.Text = "."

TF = 0

End If

End Sub

Private Sub cmdRemiseàZéro_Click()

TextBox1.Text = ""

N1 = 0

TextBox1.SetFocus

End Sub



jpleroisse



Si une réponse vous convient, cliquez Réponse Acceptée.
0
Rejoignez-nous