質問編集履歴

1

ソースコード記載しました

2019/06/04 05:57

投稿

gyaSon
gyaSon

スコア16

test CHANGED
File without changes
test CHANGED
@@ -51,3 +51,289 @@
51
51
  $=108
52
52
 
53
53
  €=120
54
+
55
+
56
+
57
+ ###その後
58
+
59
+ 求めておりました動作は何とかできるようになりました。
60
+
61
+ zuishinさんのアドバイスを組めたかどうかですが・・・。
62
+
63
+
64
+
65
+ ソースコード記載いたします。
66
+
67
+ ```Public Class Form1
68
+
69
+ Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
70
+
71
+
72
+
73
+ Dim strData() As String = {"\", "$", "€"}
74
+
75
+ 'コンボボックスにアイテムを追加する
76
+
77
+ ComboBox1.Items.AddRange(strData)
78
+
79
+ ComboBox2.Items.AddRange(strData)
80
+
81
+ ComboBox3.Items.AddRange(strData)
82
+
83
+
84
+
85
+ End Sub
86
+
87
+
88
+
89
+
90
+
91
+ Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click '円に変換
92
+
93
+ Dim Dollar As String = 108
94
+
95
+ Dim EUR As String = 120
96
+
97
+
98
+
99
+ 'テキストボックス1の円変換
100
+
101
+
102
+
103
+ If ComboBox1.SelectedIndex = 0 Then
104
+
105
+ Label1.Text = ("\" & TextBox1.Text)
106
+
107
+ ElseIf ComboBox1.SelectedIndex = 1 Then
108
+
109
+ Label1.Text = ("\" & TextBox1.Text * Dollar)
110
+
111
+ ElseIf ComboBox1.SelectedIndex = 2 Then
112
+
113
+ Label1.Text = ("\" & TextBox1.Text * EUR)
114
+
115
+ End If
116
+
117
+
118
+
119
+ 'テキストボックス2を円変換
120
+
121
+
122
+
123
+ If ComboBox2.SelectedIndex = 0 Then
124
+
125
+ Label2.Text = ("\" & TextBox2.Text)
126
+
127
+ ElseIf ComboBox2.SelectedIndex = 1 Then
128
+
129
+ Label2.Text = ("\" & TextBox2.Text * Dollar)
130
+
131
+ ElseIf ComboBox2.SelectedIndex = 2 Then
132
+
133
+ Label2.Text = ("\" & TextBox2.Text * EUR)
134
+
135
+ End If
136
+
137
+
138
+
139
+ 'テキストボックス3を円変換
140
+
141
+
142
+
143
+ If ComboBox3.SelectedIndex = 0 Then
144
+
145
+ Label3.Text = ("\" & TextBox3.Text)
146
+
147
+ ElseIf ComboBox3.SelectedIndex = 1 Then
148
+
149
+ Label3.Text = ("\" & TextBox3.Text * Dollar)
150
+
151
+ ElseIf ComboBox3.SelectedIndex = 2 Then
152
+
153
+ Label3.Text = ("\" & TextBox3.Text * EUR)
154
+
155
+ End If
156
+
157
+ End Sub
158
+
159
+
160
+
161
+ Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click '$に変換
162
+
163
+ Dim Dollar As String = 108
164
+
165
+ Dim EUR As String = 120
166
+
167
+
168
+
169
+ 'テキストボックス1のドル変換
170
+
171
+
172
+
173
+ If ComboBox1.SelectedIndex = 0 Then
174
+
175
+ Label1.Text = Format((TextBox1.Text / Dollar), "0.00")
176
+
177
+ Label1.Text = CStr("$" & Label1.Text)
178
+
179
+ ElseIf ComboBox1.SelectedIndex = 1 Then
180
+
181
+ Label1.Text = CStr("$" & TextBox1.Text)
182
+
183
+ ElseIf ComboBox1.SelectedIndex = 2 Then
184
+
185
+ Label1.Text = Format((TextBox1.Text * EUR / Dollar), "0.00")
186
+
187
+ Label1.Text = CStr("$" & Label1.Text)
188
+
189
+ End If
190
+
191
+
192
+
193
+ 'テキストボックス2をドル変換
194
+
195
+
196
+
197
+ If ComboBox2.SelectedIndex = 0 Then
198
+
199
+ Label2.Text = Format((TextBox2.Text / Dollar), "0.00")
200
+
201
+ Label2.Text = CStr("$" & Label2.Text)
202
+
203
+ ElseIf ComboBox2.SelectedIndex = 1 Then
204
+
205
+ Label2.Text = CStr("$" & TextBox2.Text)
206
+
207
+ ElseIf ComboBox2.SelectedIndex = 2 Then
208
+
209
+ Label2.Text = Format((TextBox2.Text * EUR / Dollar), "0.00")
210
+
211
+ Label2.Text = CStr("$" & Label2.Text)
212
+
213
+ End If
214
+
215
+
216
+
217
+ 'テキストボックス3をドル変換
218
+
219
+
220
+
221
+ If ComboBox3.SelectedIndex = 0 Then
222
+
223
+ Label3.Text = Format((TextBox3.Text / Dollar), "0.00")
224
+
225
+ Label3.Text = CStr("$" & Label3.Text)
226
+
227
+ ElseIf ComboBox3.SelectedIndex = 1 Then
228
+
229
+ Label3.Text = CStr("$" & TextBox3.Text)
230
+
231
+ ElseIf ComboBox3.SelectedIndex = 2 Then
232
+
233
+ Label3.Text = Format((TextBox3.Text * EUR / Dollar), "0.00")
234
+
235
+ Label3.Text = CStr("$" & Label3.Text)
236
+
237
+ End If
238
+
239
+ End Sub
240
+
241
+
242
+
243
+ Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click '€に変換
244
+
245
+
246
+
247
+ Dim Dollar As String = 108
248
+
249
+ Dim EUR As String = 120
250
+
251
+
252
+
253
+ 'テキストボックス1のユーロ変換
254
+
255
+
256
+
257
+ If ComboBox1.SelectedIndex = 0 Then
258
+
259
+ Label1.Text = Format((TextBox1.Text / EUR), "0.00")
260
+
261
+ Label1.Text = CStr("€" & Label1.Text)
262
+
263
+ ElseIf ComboBox1.SelectedIndex = 1 Then
264
+
265
+ Label1.Text = Format((TextBox1.Text * Dollar / EUR), "0.00")
266
+
267
+ Label1.Text = CStr("€" & Label1.Text)
268
+
269
+ ElseIf ComboBox1.SelectedIndex = 2 Then
270
+
271
+ Label1.Text = CStr("€" & TextBox1.Text)
272
+
273
+ End If
274
+
275
+
276
+
277
+ 'テキストボックス2をユーロ変換
278
+
279
+
280
+
281
+ If ComboBox2.SelectedIndex = 0 Then
282
+
283
+ Label2.Text = Format((TextBox2.Text / EUR), "0.00")
284
+
285
+ Label2.Text = CStr("€" & Label2.Text)
286
+
287
+ ElseIf ComboBox2.SelectedIndex = 1 Then
288
+
289
+ Label2.Text = Format((TextBox2.Text * Dollar / EUR), "0.00")
290
+
291
+ Label2.Text = CStr("€" & Label2.Text)
292
+
293
+ ElseIf ComboBox2.SelectedIndex = 2 Then
294
+
295
+ Label2.Text = CStr("€" & TextBox2.Text)
296
+
297
+ End If
298
+
299
+
300
+
301
+ 'テキストボックス3をユーロ変換
302
+
303
+
304
+
305
+ If ComboBox3.SelectedIndex = 0 Then
306
+
307
+ Label3.Text = Format((TextBox3.Text / EUR), "0.00")
308
+
309
+ Label3.Text = CStr("€" & Label3.Text)
310
+
311
+ ElseIf ComboBox3.SelectedIndex = 1 Then
312
+
313
+ Label3.Text = Format((TextBox3.Text * Dollar / EUR), "0.00")
314
+
315
+ Label3.Text = CStr("€" & Label3.Text)
316
+
317
+ ElseIf ComboBox3.SelectedIndex = 2 Then
318
+
319
+ Label3.Text = CStr("€" & TextBox3.Text)
320
+
321
+ End If
322
+
323
+ End Sub
324
+
325
+
326
+
327
+ End Class
328
+
329
+
330
+
331
+ ```
332
+
333
+ ここから省く、もしくはより分かりやすくまとめる方法が
334
+
335
+ あるのでしょうが今の私の知識ではこれで何とかというところです。
336
+
337
+
338
+
339
+ 御助力をお願いいたします。