Bonjour,
J'ai un formulaire que j'utilise pour entrer les quantités de la monnaie se trouvant dans un tiroir-caisse, il y a 15 différentes dénominations comme vous le voyez sur l'image avec le nom des 15 champs à additionner.
Lorsque je clique sur un des 15 boutons, tout se recalcule automatiquement.

Voici l'image et c'est suivi du code pour ce formulaire.
Merci
Claude du Québec, Canada

Nom : Currency management.jpg
Affichages : 232
Taille : 178,2 Ko
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
Public Class CurrencyManagement
    Private Sub BtnClose_Click(sender As Object, e As EventArgs) Handles BtnClose.Click
        Me.Close()
    End Sub
 
    Private Sub BtnMaximize_Click(sender As Object, e As EventArgs) Handles BtnMaximize.Click
        WindowState = FormWindowState.Maximized
        Me.BtnNormal.Visible = True
        Me.BtnMaximize.Visible=false
    End Sub
 
    Private Sub BtnNormal_Click(sender As Object, e As EventArgs) Handles BtnNormal.Click
        WindowState = FormWindowState.Normal
        Me.BtnMaximize.Visible = True
        Me.BtnNormal.Visible=False
    End Sub
 
    Private Sub BtnMinimize_Click(sender As Object, e As EventArgs) Handles BtnMinimize.Click
        WindowState = FormWindowState.Minimized
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If Label1.Text = "0" Then
            Label1.Text = "1"
        Else 
            Label1.Text = Label1.Text + "1"
        End If
    End Sub
 
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        If Label1.Text = "0" Then
            Label1.Text = "2"
        Else 
            Label1.Text = Label1.Text + "2"
        End If
    End Sub
 
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        If Label1.Text = "0" Then
            Label1.Text = "3"
        Else 
            Label1.Text = Label1.Text + "3"
        End If
    End Sub
 
    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        If Label1.Text = "0" Then
            Label1.Text = "4"
        Else 
            Label1.Text = Label1.Text + "4"
        End If
    End Sub
 
    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        If Label1.Text = "0" Then
            Label1.Text = "5"
        Else 
            Label1.Text = Label1.Text + "5"
        End If
    End Sub
 
    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        If Label1.Text = "0" Then
            Label1.Text = "6"
        Else 
            Label1.Text = Label1.Text + "6"
        End If
    End Sub
 
    Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
        If Label1.Text = "0" Then
            Label1.Text = "7"
        Else 
            Label1.Text = Label1.Text + "7"
        End If
    End Sub
 
    Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
        If Label1.Text = "0" Then
            Label1.Text = "8"
        Else 
            Label1.Text = Label1.Text + "8"
        End If
    End Sub
 
    Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
        If Label1.Text = "0" Then
            Label1.Text = "9"
        Else 
            Label1.Text = Label1.Text + "9"
        End If
    End Sub
 
    Private Sub ButtonC_Click(sender As Object, e As EventArgs) Handles ButtonC.Click
        Label1.Text=""
        'Label2.Text=""
        Label1.Text="0"
    End Sub
 
    Private Sub Button0_Click(sender As Object, e As EventArgs) Handles Button0.Click
        If Label1.Text = "0" Then
            Label1.Text = "0"
        Else 
            Label1.Text = Label1.Text + "0"
        End If
    End Sub
 
    Private Sub Btn100D_Click(sender As Object, e As EventArgs) Handles Btn100D.Click
            Me.Qty100D.Text = Label1.Text
            Label1.Text = "0"
            Text100Value.Text=(Convert.ToInt32(Qty100D.Text)*Convert.ToInt32(Btn100D.Text))
    End Sub
 
 
    Private Sub Btn50D_Click(sender As Object, e As EventArgs) Handles Btn50D.Click
            Me.Qty50D.Text = Label1.Text
            Label1.Text = "0"
            Text50Value.Text=(Convert.ToInt32(Qty50D.Text)*Convert.ToInt32(Btn50D.Text))
    End Sub
    Private Sub Btn20D_Click(sender As Object, e As EventArgs) Handles Btn20D.Click
            Me.Qty20D.Text = Label1.Text
            Label1.Text = "0"
            Text20Value.Text=(Convert.ToInt32(Qty20D.Text)*Convert.ToInt32(Btn20D.Text))
    End Sub
 
    Private Sub Btn10D_Click(sender As Object, e As EventArgs) Handles Btn10D.Click
            Me.Qty10D.Text = Label1.Text
            Label1.Text = "0"
            Text10Value.Text=(Convert.ToInt32(Qty10D.Text)*Convert.ToInt32(Btn10D.Text))
    End Sub
 
    Private Sub Btn5D_Click(sender As Object, e As EventArgs) Handles Btn5D.Click
            Me.Qty5D.Text = Label1.Text
            Label1.Text = "0"
            Text5Value.Text=(Convert.ToInt32(Qty5D.Text)*Convert.ToInt32(Btn5D.Text))
    End Sub
 
    Private Sub Btn2D_Click(sender As Object, e As EventArgs) Handles Btn2D.Click
            Me.Qty2D.Text = Label1.Text
            Label1.Text = "0"
            Text2Value.Text=(Convert.ToInt32(Qty2D.Text)*Convert.ToInt32(Btn2D.Text))
    End Sub
 
    Private Sub Btn1D_Click(sender As Object, e As EventArgs) Handles Btn1D.Click
            Me.Qty1D.Text = Label1.Text
            Label1.Text = "0"
            Text1Value.Text=(Convert.ToInt32(Qty1D.Text)*Convert.ToInt32(Btn1D.Text))
    End Sub
 
    Private Sub Btn25C_Click(sender As Object, e As EventArgs) Handles Btn25C.Click
 
            Me.Qty25C.Text = Label1.Text
            Label1.Text = "0"
            Text25CValue.Text=(Convert.ToInt64(Qty25C.Text)*0.25)
    End Sub
 
    Private Sub Btn10C_Click(sender As Object, e As EventArgs) Handles Btn10C.Click
            Me.Qty10C.Text = Label1.Text
            Label1.Text = "0"
            Text10CValue.Text=(Convert.ToInt32(Qty10C.Text)*0.10)
    End Sub
 
    Private Sub Btn5C_Click(sender As Object, e As EventArgs) Handles Btn5C.Click
            Me.Qty5C.Text = Label1.Text
            Label1.Text = "0"
            Text5CValue.Text=(Convert.ToInt32(Qty5C.Text)*0.05)
    End Sub
 
    Private Sub Btn1C_Click(sender As Object, e As EventArgs) Handles Btn1C.Click
            Me.Qty1C.Text = Label1.Text
            Label1.Text = "0"
            Text1CValue.Text=(Convert.ToInt32(Qty1C.Text)*0.01)
    End Sub
 
    Private Sub Btn25R_Click(sender As Object, e As EventArgs) Handles Btn25R.Click
        Me.Qty25R.Text = Label1.Text
        Label1.Text = "0"
        Text25RValue.Text=(Convert.ToInt32(Qty25R.Text)*Convert.ToInt32(Btn25R.Text))
    End Sub
 
    Private Sub Btn10R_Click(sender As Object, e As EventArgs) Handles Btn10R.Click
        Me.Qty10R.Text = Label1.Text
        Label1.Text = "0"
        Text10RValue.Text=(Convert.ToInt32(Qty10R.Text)*Convert.ToInt32(Btn10R.Text))
     End Sub
 
    Private Sub Btn5R_Click(sender As Object, e As EventArgs) Handles Btn5R.Click
        Me.Qty5R.Text = Label1.Text
        Label1.Text = "0"
        Text5RValue.Text=(Convert.ToInt32(Qty5R.Text)*Convert.ToInt32(Btn5R.Text))
    End Sub
 
    Private Sub Btn1R_Click(sender As Object, e As EventArgs) Handles Btn1R.Click
        Me.Qty1R.Text = Label1.Text
        Label1.Text = "0"
        Text1RValue.Text=(Convert.ToInt32(Qty1R.Text)*0.50)
    End Sub
 
    Private Sub CurrencyManagement_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Qty100D.ReadOnly = True
        Me.Qty50D.ReadOnly = True
        Me.Qty20D.ReadOnly = True
        Me.Qty10D.ReadOnly = True
        Me.Qty5D.ReadOnly = True
        Me.Qty2D.ReadOnly = True
        Me.Qty1D.ReadOnly = True
    End Sub
 
    Private Sub Text100Value_TextChanged(sender As Object, e As EventArgs) Handles Text100Value.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text100Value.Text.Trim(), value) Then
            Text100Value.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text50Value_TextChanged(sender As Object, e As EventArgs) Handles Text50Value.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text50Value.Text.Trim(), value) Then
            Text50Value.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text20Value_TextChanged(sender As Object, e As EventArgs) Handles Text20Value.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text20Value.Text.Trim(), value) Then
            Text20Value.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text10Value_TextChanged(sender As Object, e As EventArgs) Handles Text10Value.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text10Value.Text.Trim(), value) Then
            Text10Value.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text5Value_TextChanged(sender As Object, e As EventArgs) Handles Text5Value.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text5Value.Text.Trim(), value) Then
            Text5Value.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text2Value_TextChanged(sender As Object, e As EventArgs) Handles Text2Value.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text2Value.Text.Trim(), value) Then
            Text2Value.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text1Value_TextChanged(sender As Object, e As EventArgs) Handles Text1Value.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text1Value.Text.Trim(), value) Then
            Text1Value.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text25CValue_TextChanged(sender As Object, e As EventArgs) Handles Text25CValue.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text25CValue.Text.Trim(), value) Then
            Text25CValue.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text10CValue_TextChanged(sender As Object, e As EventArgs) Handles Text10CValue.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text10CValue.Text.Trim(), value) Then
            Text10CValue.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text5CValue_TextChanged(sender As Object, e As EventArgs) Handles Text5CValue.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text5CValue.Text.Trim(), value) Then
            Text5CValue.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text1CValue_TextChanged(sender As Object, e As EventArgs) Handles Text1CValue.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text1CValue.Text.Trim(), value) Then
            Text1CValue.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text25RValue_TextChanged(sender As Object, e As EventArgs) Handles Text25RValue.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text25RValue.Text.Trim(), value) Then
            Text25RValue.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text10RValue_TextChanged(sender As Object, e As EventArgs) Handles Text10RValue.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text10RValue.Text.Trim(), value) Then
            Text10RValue.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text5RValue_TextChanged(sender As Object, e As EventArgs) Handles Text5RValue.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text5RValue.Text.Trim(), value) Then
            Text5RValue.Text = value.ToString("c")
            End If
    End Sub
 
    Private Sub Text1RValue_TextChanged(sender As Object, e As EventArgs) Handles Text1RValue.TextChanged
        Dim value As Decimal
            If Decimal.TryParse(Text1RValue.Text.Trim(), value) Then
            Text1RValue.Text = value.ToString("c")
            End If
    End Sub
End Class