Cours-Gratuit
  • Accueil
  • Blog
  • Cours informatique
home icon Cours gratuits » Cours informatique » Cours programmation » Cours visual basic » Exercices VB »

Articles similaires

  • Exercice VB: Calculatrice Simplifié
  • Exercice PHP Traitement d'un formulaire
  • Exercice Merise: Opération sur un Article
  • Exercices sur la config conscrits - Interface
  • Excel : comment calculer l'age à partir de la date de naissance
  • Exercice opération sur les tableaux JAVA
  • Exercice: qualifier la nature juridique d'une opération de filiatisation en comptabilité
  • Exercice en comptabilité générale : Les écritures comptables
  • Comment analyser le bilan et le compte de résultat?
  • Exercice comptabilité : détermination du résultat et Écritures de régularisation au 31/12/N
  • Exercice VB: Programme Conjugaison des verbes
  • Tuto Python : Les listes : la méthode EXTEND()

Documents similaires

  • Projet de calculatrice scientifique en langage C

  • Mini projet calculatrice avec JAVA

  • Application Excel calculatrice de montant TVA

  • Qu'est-ce le compte de résultat d'une entreprise ?

  • Initiation à l’algorithmique

  • Exercice bureautique pour réviser ensemble

  • Modèle sur Excel de bilan et compte de résultat

  • Mini projet de programmation en langage C

Exercice VB: Programme Calculatrice

Rédigé par GC Team, Publié le 04 Janvier 2012, Mise à jour le Mardi, 30 Novembre 1999 00:00
Participez au vote ☆☆☆☆☆★★★★★

Ecrire le code pour réaliser l'interface suivante:

ExerciceVB-id2096 


 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim operande1, operande2, resultat As Double
    Dim div As Double
    Dim operation As String
 
    Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button22.Click
        operande1 = Val(T.Text)
        T.Text = ""
        operation = "-"
        Button13.Enabled = True
    End Sub
 
    Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click
        If T.Text  "0" Then
            T.Text &= 0
        Else
            T.Text = 0
        End If
    End Sub
 
    Private Sub Button28_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button28.Click
        Dim i As Int32
        Dim trouve As Boolean = False
        T.Text &= "."
        Button13.Enabled = False
    End Sub
 
    Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click
        T.Text &= 1
    End Sub
 
    Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click
        T.Text &= 2
    End Sub
 
    Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click
        T.Text &= 3
    End Sub
 
    Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button27.Click
        operande1 = Val(T.Text)
        T.Text = ""
        operation = "+"
        Button13.Enabled = True
    End Sub
 
    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        T.Text &= 4
    End Sub
 
    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
        T.Text &= 5
    End Sub
 
    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        T.Text &= 6
    End Sub
 
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        T.Text &= 7
    End Sub
 
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        T.Text &= 8
    End Sub
 
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        T.Text &= 9
    End Sub
 
    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
        operande1 = Val(T.Text)
        T.Text = ""
        operation = "*"
        Button13.Enabled = True
    End Sub
 
    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        operande1 = Val(T.Text)
        T.Text = ""
        operation = "/"
        Button13.Enabled = True
    End Sub
 
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        T.Text = ""
    End Sub
 
    Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button23.Click
        operande2 = Val(T.Text)
        If operation = "/" And operande2 = 0 Then
            T.Text = ("division par 0 est impossible ")
        Else
            resultat = operande1 / operande2
            T.Text = resultat
        End If
        If operation = "+" Then
            T.Text = operande1 + operande2
        End If
        If operation = "-" Then
            T.Text = operande1 - operande2
        End If
        If operation = "*" Then
            T.Text = operande1 * operande2
        End If
    End Sub
 
    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        't1.text=val(t.Text)*
    End Sub
 
    Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B2.Click
        T.Text = 1 / Val(T.Text)
        B2.Refresh()
    End Sub
 
    Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click
        T.Text = (-1) * (T.Text)
    End Sub
 
    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        End
    End Sub
 
    Private Sub g_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles g.Enter
        B9.Enabled = False
    End Sub
End Class
  • Contactez-nous
  • A propos de nous
  • On recrute
  • Rechercher dans le site
  • Politique de confidentialité
  • Droit d'auteur/Copyright
  • Conditions générales d'utilisation
  • Plan du site
  • Accueil
  • Blog
  • Finance et compta.
  • Formations Pro.
  • Logiciels & Apps
  • Organisation
  • Cours informatique
  • Aide à la rédaction
  • Etudes et Metiers
  • Science et Tech
  • Titans de la Tech
id 11354 02