質問編集履歴
1
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -54,7 +54,7 @@
|
|
54
54
|
|
55
55
|
|
56
56
|
|
57
|
-
新規登録画面コード
|
57
|
+
**新規登録画面コード**
|
58
58
|
|
59
59
|
|
60
60
|
|
@@ -80,7 +80,9 @@
|
|
80
80
|
|
81
81
|
Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
82
82
|
|
83
|
-
|
83
|
+
Dim frm As New new_user()
|
84
|
+
|
85
|
+
frm.ShowDialog(Me)
|
84
86
|
|
85
87
|
|
86
88
|
|
@@ -136,8 +138,6 @@
|
|
136
138
|
|
137
139
|
|
138
140
|
|
139
|
-
|
140
|
-
|
141
141
|
'性別の判定
|
142
142
|
|
143
143
|
Dim gender As String
|
@@ -182,25 +182,21 @@
|
|
182
182
|
|
183
183
|
|
184
184
|
|
185
|
-
Dim i As Integer
|
186
|
-
|
187
|
-
i = DataGridView1.Rows.Count - 1
|
185
|
+
Dim i As Integer = DataGridView1.Rows.Count - 1
|
188
186
|
|
189
187
|
|
190
188
|
|
191
189
|
'追加した行に値をセット
|
192
190
|
|
193
|
-
DataGridView1.Rows(i).Cells(0).Value = id
|
191
|
+
DataGridView1.Rows(i).Cells(0).Value = frm.id
|
194
|
-
|
192
|
+
|
195
|
-
DataGridView1.Rows(i).Cells(1).Value = pass
|
193
|
+
DataGridView1.Rows(i).Cells(1).Value = frm.pass
|
196
|
-
|
194
|
+
|
197
|
-
DataGridView1.Rows(i).Cells(2).Value =
|
195
|
+
DataGridView1.Rows(i).Cells(2).Value = frm.Name
|
198
|
-
|
196
|
+
|
199
|
-
DataGridView1.Rows(i).Cells(3).Value = gender
|
197
|
+
DataGridView1.Rows(i).Cells(3).Value = frm.gender
|
200
|
-
|
198
|
+
|
201
|
-
DataGridView1.Rows(i).Cells(4).Value = age
|
199
|
+
DataGridView1.Rows(i).Cells(4).Value = frm.age
|
202
|
-
|
203
|
-
|
204
200
|
|
205
201
|
|
206
202
|
|
@@ -212,6 +208,298 @@
|
|
212
208
|
|
213
209
|
|
214
210
|
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
'ユーザーIDが空白の場合
|
218
|
+
|
219
|
+
If id = "" Then
|
220
|
+
|
221
|
+
ID_null_error.Show()
|
222
|
+
|
223
|
+
flg = 1
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
'ユーザーIDが11文字以上の場合
|
228
|
+
|
229
|
+
ElseIf lenid > 11 Then
|
230
|
+
|
231
|
+
ID_10over_error.Show()
|
232
|
+
|
233
|
+
flg = 1
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
'ユーザーIDが半角英数字かの判定
|
238
|
+
|
239
|
+
ElseIf System.Text.RegularExpressions.Regex.IsMatch(id, "^[a-zA-Z0-9]+$") = False Then
|
240
|
+
|
241
|
+
ID_hankaku_error.Show()
|
242
|
+
|
243
|
+
flg = 1
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
End If
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
'パスワードが空白の場合
|
258
|
+
|
259
|
+
If pass = "" Then
|
260
|
+
|
261
|
+
PASS_null_error.Show()
|
262
|
+
|
263
|
+
flg = 1
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
'パスワードが3文字~10字以外のとき
|
268
|
+
|
269
|
+
ElseIf 3 > lenpass Or lenpass > 10 Then
|
270
|
+
|
271
|
+
PASS_mozisuu_error.Show()
|
272
|
+
|
273
|
+
flg = 1
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
'パスワードが半角英数字かの判定
|
278
|
+
|
279
|
+
ElseIf System.Text.RegularExpressions.Regex.IsMatch(pass, "^[a-zA-Z0-9]+$") = False Then
|
280
|
+
|
281
|
+
PASS_hankaku_error.Show()
|
282
|
+
|
283
|
+
flg = 1
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
End If
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
'ユーザー名が空白の場合
|
296
|
+
|
297
|
+
If name = "" Then
|
298
|
+
|
299
|
+
name_null_error.Show()
|
300
|
+
|
301
|
+
flg = 1
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
'ユーザー名が50文字を超える場合
|
306
|
+
|
307
|
+
ElseIf lenname > 50 Then
|
308
|
+
|
309
|
+
name_50over_error.Show()
|
310
|
+
|
311
|
+
flg = 1
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
End If
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
'年齢が空白の場合
|
324
|
+
|
325
|
+
If age = "" Then
|
326
|
+
|
327
|
+
age_null_error.Show()
|
328
|
+
|
329
|
+
flg = 1
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
'年齢が半角数字かの判定
|
334
|
+
|
335
|
+
ElseIf System.Text.RegularExpressions.Regex.IsMatch(age, "^[0-9]+$") = False Then
|
336
|
+
|
337
|
+
agehankaku_error.Show()
|
338
|
+
|
339
|
+
flg = 1
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
End If
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
'エラーが出なかったら登録画面を閉じる
|
352
|
+
|
353
|
+
'If flg = 0 Then
|
354
|
+
|
355
|
+
'自画面を非表示
|
356
|
+
|
357
|
+
'Me.Visible = False
|
358
|
+
|
359
|
+
'End If
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
End Sub
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
'キャンセル 押すとポップアップを閉じる'
|
374
|
+
|
375
|
+
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
'自画面を非表示
|
380
|
+
|
381
|
+
Me.Visible = False
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
End Sub
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
**ユーザー一覧コード**
|
398
|
+
|
399
|
+
Public Class all_user
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
404
|
+
|
405
|
+
'TODO: このコード行はデータを 'SHINAGAWA_TRAININGDataSet.MST_USER' テーブルに読み込みます。必要に応じて移動、または削除をしてください。
|
406
|
+
|
407
|
+
Me.MST_USERTableAdapter.Fill(Me.SHINAGAWA_TRAININGDataSet.MST_USER)
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
End Sub
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
'ログアウト ログイン画面へ'
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
426
|
+
|
427
|
+
'自画面を非表示
|
428
|
+
|
429
|
+
Me.Visible = False
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
'Form1を表示
|
434
|
+
|
435
|
+
Dim f2 As New rogin
|
436
|
+
|
437
|
+
f2.Show()
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
End Sub
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
'戻る メニュー画面へ'
|
446
|
+
|
447
|
+
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
'自画面を非表示
|
452
|
+
|
453
|
+
Me.Visible = False
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
'Form2を表示
|
458
|
+
|
459
|
+
Dim f2 As New Menu
|
460
|
+
|
461
|
+
f2.Show()
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
End Sub
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
'新規登録 登録画面へ'
|
472
|
+
|
473
|
+
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
Dim f2 As New new_user
|
480
|
+
|
481
|
+
f2.Show()
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
End Sub
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
End Sub
|
498
|
+
|
499
|
+
End Class
|
500
|
+
|
501
|
+
|
502
|
+
|
215
503
|
```
|
216
504
|
|
217
505
|
|