This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudentEnrollment.vb
2082 lines (1459 loc) · 76.9 KB
/
StudentEnrollment.vb
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Imports System.Data.OleDb
Imports System.IO
Public Class StudentEnrollment
Private currentForm As Form = Nothing
Private Sub OpenChildForm(childForm As Form)
If currentForm IsNot Nothing Then currentForm.Close()
currentForm = childForm
childForm.TopLevel = False
childForm.FormBorderStyle = FormBorderStyle.None
childForm.Dock = DockStyle.Fill
childForm.BringToFront()
childForm.Show()
End Sub
Public Sub Subject()
StudentRequirements.Hide()
StudentRegistered.Hide()
Dim newmdichild As New StudentSubject With {
.MdiParent = Me
}
newmdichild.Show()
OpenChildForm(New StudentSubject())
End Sub
Public Sub Requirements()
StudentSubject.Dispose()
StudentRegistered.Dispose()
Dim newmdichild As New StudentRequirements With {
.MdiParent = Me
}
newmdichild.Show()
OpenChildForm(New StudentRequirements())
End Sub
Public Sub Registered()
StudentSubject.Dispose()
StudentRequirements.Dispose()
Dim newmdichild As New StudentRegistered With {
.MdiParent = Me
}
newmdichild.Show()
OpenChildForm(New StudentRegistered())
End Sub
Private Sub CmbStatus_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbStatus.SelectedIndexChanged
If cmbStatus.Text = "Old Student" Then
pnlOldStudent.Visible = True
Else
pnlOldStudent.Visible = False
txtStudentNumber.Text = ""
btnNext.Text = "Next"
btnNext.BackColor = Color.Blue
Clear()
cmbGradeLevel.Enabled = True
cmbStrand.Enabled = True
cmbSemester.Enabled = True
cmbSchoolYear.Enabled = True
txtLastname.Enabled = True
txtFirstname.Enabled = True
txtMiddlename.Enabled = True
txtAge.Enabled = True
dtpDOB.Enabled = True
rdoMale.Enabled = True
rdoFemale.Enabled = True
txtPOB.Enabled = True
txtNationality.Enabled = True
txtReligion.Enabled = True
txtMobileNo.Enabled = True
txtStudentAddress1.Enabled = True
txtStudentAddress2.Enabled = True
txtFatherName.Enabled = True
txtMotherName.Enabled = True
rdoFather.Enabled = True
rdoMother.Enabled = True
rdoOthers.Enabled = True
txtGuardianName.Enabled = True
txtGuardianContactNo.Enabled = True
rdoMale.Checked = True
rdoFather.Checked = True
End If
End Sub
Private Sub CmbGradeLevel_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbGradeLevel.SelectedIndexChanged
If cmbGradeLevel.Text = "Grade 11 - Senior High School" Or cmbGradeLevel.Text = "Grade 12 - Senior High School" Then
pnlSHS.Visible = True
Else
pnlSHS.Visible = False
End If
End Sub
Private Function RequiredEntry() As Boolean
Try
If cmbStatus.Text = "Old Student" Then
If Len(Trim(txtStudentNumber.Text)) = 0 Then
MessageBox.Show("Please enter Student Number.", "Attention!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtStudentNumber.Focus()
Return True
Exit Function
End If
End If
If cmbGradeLevel.Text = "Grade 11 - Senior High School" Or cmbGradeLevel.Text = "Grade 12 - Senior High School" Then
If (Len(Trim(cmbStrand.Text)) Or Len(Trim(cmbSemester.Text))) = 0 Then
If Len(Trim(cmbStrand.Text)) = 0 Then
MessageBox.Show("Please choose a preferred strand.", "Attention!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
cmbStrand.Focus()
Return True
Exit Function
ElseIf Len(Trim(cmbSemester.Text)) = 0 Then
MessageBox.Show("Please choose a semester.", "Attention!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
cmbSemester.Focus()
Return True
Exit Function
End If
End If
End If
If (Len(Trim(cmbStatus.Text)) Or Len(Trim(cmbGradeLevel.Text)) Or Len(Trim(cmbSchoolYear.Text)) Or Len(Trim(txtLastname.Text)) Or Len(Trim(txtFirstname.Text)) Or Len(Trim(txtAge.Text)) Or Len(Trim(txtPOB.Text)) Or Len(Trim(txtNationality.Text)) Or Len(Trim(txtReligion.Text)) Or Len(Trim(txtMobileNo.Text)) Or Len(Trim(txtStudentAddress1.Text)) Or Len(Trim(txtStudentAddress2.Text)) Or Len(Trim(txtFatherName.Text)) Or Len(Trim(txtMotherName.Text)) Or Len(Trim(txtGuardianName.Text)) Or Len(Trim(txtGuardianContactNo.Text))) = 0 Then
MessageBox.Show("Please enter all required information.", "Attention!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Return True
Exit Function
End If
Catch ex As Exception
MsgBox(ex.Message(), MsgBoxStyle.Critical, "Require entry error")
Exit Function
End Try
End Function
Sub Clear()
txtEnrollmentNo.Text = ""
pnlOldStudent.Visible = False
pnlSHS.Visible = False
txtStudentNumber.Text = ""
cmbStatus.Text = ""
cmbStatus.Text = "New Student"
cmbGradeLevel.Text = ""
cmbGradeLevel.Text = "Nursery - Pre-School"
cmbStrand.Text = ""
cmbSemester.Text = ""
txtLastname.Text = ""
txtFirstname.Text = ""
txtMiddlename.Text = ""
txtAge.Text = ""
rdoMale.Checked = False
rdoFemale.Checked = False
txtPOB.Text = ""
txtNationality.Text = ""
txtReligion.Text = ""
txtEmail.Text = ""
txtMobileNo.Text = ""
txtTelephoneNo.Text = ""
txtStudentAddress1.Text = ""
txtStudentAddress2.Text = ""
StudentPic.Image = Image.FromFile(My.Application.Info.DirectoryPath & "\Image\personal.png")
txtFatherName.Text = ""
txtFatherOccupation.Text = ""
txtFatherEmail.Text = ""
txtFatherWorkAddress.Text = ""
txtFatherContactNo.Text = ""
txtMotherName.Text = ""
txtMotherOccupation.Text = ""
txtMotherEmail.Text = ""
txtMotherWorkAddress.Text = ""
txtMotherContactNo.Text = ""
txtNoOfSiblings.Text = ""
rdoFather.Checked = False
rdoMother.Checked = False
rdoOthers.Checked = False
txtGuardianName.Text = ""
txtGuardianRelation.Text = ""
txtGuardianEmail.Text = ""
txtGuardianWorkAddress.Text = ""
txtGuardianContactNo.Text = ""
txtFetcherName.Text = ""
txtFetcherContactNo.Text = ""
txtSiblingsofStudent1.Text = ""
txtSiblingsofStudent2.Text = ""
txtSiblingsofStudent3.Text = ""
txtSiblingsAge1.Text = ""
txtSiblingsAge2.Text = ""
txtSiblingsAge3.Text = ""
txtSiblingsSchool1.Text = ""
txtSiblingsSchool2.Text = ""
txtSiblingsSchool3.Text = ""
txtSchoolLastAttended1.Text = ""
txtSchoolLastAttended2.Text = ""
txtSchoolLastAttended3.Text = ""
txtAcademicYear1.Text = ""
txtAcademicYear2.Text = ""
txtAcademicYear3.Text = ""
txtReasonApplying.Text = ""
rdoMale.Checked = True
rdoFather.Checked = True
End Sub
Private Sub RoundButtonCheck(btn As Button)
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 14)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
Raduis.AddLine(10, 0, btn.Width - 20, 0)
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnCheck.Width, 20, btn.Width, btn.Height - 10)
Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 25, 25, 25), 0, 90)
Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()
btnCheck.Region = New Region(Raduis)
End Sub
Private Sub RoundButtonCapture(btn As Button)
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 12)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
Raduis.AddLine(10, 0, btn.Width - 20, 0)
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnCapture.Width, 20, btn.Width, btn.Height - 10)
Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 25, 25, 25), 0, 90)
Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()
btnCapture.Region = New Region(Raduis)
End Sub
Private Sub RoundButtonBrowse(btn As Button)
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 12)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
Raduis.AddLine(10, 0, btn.Width - 20, 0)
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnBrowse.Width, 20, btn.Width, btn.Height - 10)
Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 25, 25, 25), 0, 90)
Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()
btnBrowse.Region = New Region(Raduis)
End Sub
Private Sub RoundButtonRemove(btn As Button)
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 12)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
Raduis.AddLine(10, 0, btn.Width - 20, 0)
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnRemove.Width, 20, btn.Width, btn.Height - 10)
Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 25, 25, 25), 0, 90)
Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()
btnRemove.Region = New Region(Raduis)
End Sub
Private Sub RoundButtonNext(btn As Button)
btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 14)
Dim Raduis As New Drawing2D.GraphicsPath
Raduis.StartFigure()
Raduis.AddArc(New Rectangle(0, 0, 20, 20), 180, 90)
Raduis.AddLine(10, 0, btn.Width - 20, 0)
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnNext.Width, 20, btn.Width, btn.Height - 10)
Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 25, 25, 25), 0, 90)
Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()
btnNext.Region = New Region(Raduis)
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PictureBox2.Visible = True
Clear()
If LoginForm.cmbFormState.Text <> "Admin" Then cmbStatus.Items.RemoveAt(1)
dtpDOB.MaxDate = Today
dtpDOB.Value = Today
dtbIdentify.Value = Now
rdoMale.Checked = True
rdoFather.Checked = True
RoundButtonCheck(btnCheck)
RoundButtonCapture(btnCapture)
RoundButtonBrowse(btnBrowse)
RoundButtonRemove(btnRemove)
RoundButtonNext(btnNext)
End Sub
Private Sub BtnCapture_Click(sender As Object, e As EventArgs) Handles btnCapture.Click
CapturePicture.Show()
cmbEnrollment.Text = "Enrollment"
End Sub
Private Sub BtnBrowse_Click(sender As Object, e As EventArgs) Handles btnBrowse.Click
Dim OpenFile As New OpenFileDialog()
Try
With OpenFile
.FileName = ""
.Title = "Photo:"
.Filter = "Image files: (*.jpg)|*.jpg|(*.jpeg)|*.jpeg|(*.png)|*.png|(*.Gif)|*.Gif|(*.bmp)|*.bmp| All Files (*.*)|*.*"
If .ShowDialog = Windows.Forms.DialogResult.OK Then
StudentPic.Image = Image.FromFile(.FileName)
End If
End With
Catch ex As Exception
MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error...")
Exit Sub
End Try
End Sub
Private Sub BtnRemove_Click(sender As Object, e As EventArgs) Handles btnRemove.Click
StudentPic.Image = Image.FromFile(My.Application.Info.DirectoryPath & "\Image\personal.png")
End Sub
Private Sub BtnNext_Click(sender As Object, e As EventArgs) Handles btnNext.Click
Try
dtbIdentify.Value = Now
If RequiredEntry() Then Return
If btnNext.Text = "Change" Then
Dim ChangeConnection As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database\Pre-enrollment.accdb")
If ChangeConnection.State = ConnectionState.Open Then ChangeConnection.Close()
ChangeConnection.Open()
Dim ChangeCommand As New OleDbCommand("Update EnrollmentData Set StudentNumber=@SNum,GradeLevel=@SGrade,Strand=@Strand,Semester=@Semester,SchoolYear=@SchoolYear,Lastname=@Lastname,Firstname=@Firstname,Middlename=@Middlename,Age=@Age,DOB=@DOB,Sex=@Sex,POB=@POB,Nationality=@Nationality,Religion=@Religion,Email=@Email,MobileNumber=@MobileNumber,TelephoneNumber=@TelephoneNumber,Address=@Address,City=@City,FatherName=@FName,FatherOccupation=@FOccupation,FatherEmail=@FEmail,FatherWorkAddress=@FWorkAddress,FatherContactNumber=@FContactNumber,MotherName=@MName,MotherOccupation=@MOccupation,MotherEmail=@MEmail,MotherWorkAddress=@MWorkAddress,MotherContactNumber=@MContactNumber,NumberOfSiblings=@NumOfSiblings,PersonEmergency=@PersonEmergency,GuardianName=@GName,GuardianRelation=@GRelation,GuardianEmail=@GEmail,GuardianWorkAddress=@GWorkAddress,GuardianContactNumber=@GContactNumber,FetcherName=@FetcherName,FetcherContactNumber=@FetcherContactNumber,SiblingsOfStudent1=@SiblingsOfStudent1,SiblingsOfStudent2=@SiblingsOfStudent2,SiblingsOfStudent3=@SiblingsOfStudent3,SiblingsOfStudentAge1=@SiblingsOfStudentAge1,SiblingsOfStudentAge2=@SiblingsOfStudentAge2,SiblingsOfStudentAge3=@SiblingsOfStudentAge3,SiblingsOfStudentSchool1=@SiblingsOfStudentSchool1,SiblingsOfStudentSchool2=@SiblingsOfStudentSchool2,SiblingsOfStudentSchool3=@SiblingsOfStudentSchool3,SchoolLastAttended1=@SchoolLastAttended1,SchoolLastAttended2=@SchoolLastAttended2,SchoolLastAttended3=@SchoolLastAttended3,AcademicYear1=@AYear1,AcademicYear2=@AYear2,AcademicYear3=@AYear3,ReasonApplying=@ReasonApplying,StudentPicture=@SPic Where (StudentNumber='" & txtStudentNumber.Text & "') ", ChangeConnection)
' Student Number
Dim StudentNumber As New OleDbParameter("@SNum", OleDbType.VarWChar, 25) With {
.Value = txtStudentNumber.Text.ToString()
}
ChangeCommand.Parameters.Add(StudentNumber)
' Grade Level
Dim GradeLevel As New OleDbParameter("@SGrade", OleDbType.VarWChar, 30) With {
.Value = cmbGradeLevel.Text.ToString()
}
ChangeCommand.Parameters.Add(GradeLevel)
' Strand
Dim Strand As New OleDbParameter("@Strand", OleDbType.VarWChar, 70) With {
.Value = cmbStrand.Text.ToString()
}
ChangeCommand.Parameters.Add(Strand)
' Semester
Dim Semester As New OleDbParameter("@Semester", OleDbType.VarWChar, 30) With {
.Value = cmbSemester.Text.ToString()
}
ChangeCommand.Parameters.Add(Semester)
' School Year
Dim SchoolYear As New OleDbParameter("@SchoolYear", OleDbType.VarWChar, 30) With {
.Value = cmbSchoolYear.Text.ToString()
}
ChangeCommand.Parameters.Add(SchoolYear)
' Lastname
Dim Lastname As New OleDbParameter("@Lastname", OleDbType.VarWChar, 30) With {
.Value = txtLastname.Text.ToString()
}
ChangeCommand.Parameters.Add(Lastname)
' Firstname
Dim Firstname As New OleDbParameter("@Firstname", OleDbType.VarWChar, 30) With {
.Value = txtFirstname.Text.ToString()
}
ChangeCommand.Parameters.Add(Firstname)
' Middlename
Dim Middlename As New OleDbParameter("@Middlename", OleDbType.VarWChar, 30) With {
.Value = txtMiddlename.Text.ToString()
}
ChangeCommand.Parameters.Add(Middlename)
' Age
Dim Age As New OleDbParameter("@Age", OleDbType.VarWChar, 10) With {
.Value = txtAge.Text.ToString()
}
ChangeCommand.Parameters.Add(Age)
' Date of Birth
Dim DOB As New OleDbParameter("@DOB", OleDbType.Date, 15) With {
.Value = dtpDOB.Text.ToString()
}
ChangeCommand.Parameters.Add(DOB)
' Sex
Dim Sex As New OleDbParameter("@Sex", OleDbType.VarWChar, 15)
If rdoMale.Checked Then
Sex.Value = rdoMale.Text.ToString()
ElseIf rdoFemale.Checked Then
Sex.Value = rdoFemale.Text.ToString()
End If
ChangeCommand.Parameters.Add(Sex)
' Place of Birth
Dim POB As New OleDbParameter("@POB", OleDbType.VarWChar, 30) With {
.Value = txtPOB.Text.ToString()
}
ChangeCommand.Parameters.Add(POB)
' Nationality
Dim Nationality As New OleDbParameter("@Nationality", OleDbType.VarWChar, 30) With {
.Value = txtNationality.Text.ToString()
}
ChangeCommand.Parameters.Add(Nationality)
' Religion
Dim Religion As New OleDbParameter("@Religion", OleDbType.VarWChar, 30) With {
.Value = txtReligion.Text.ToString()
}
ChangeCommand.Parameters.Add(Religion)
' Email
Dim Email As New OleDbParameter("@Email", OleDbType.VarWChar, 40) With {
.Value = txtEmail.Text.ToString()
}
ChangeCommand.Parameters.Add(Email)
' Mobile Number
Dim MobileNumber As New OleDbParameter("@MobileNumber", OleDbType.VarWChar, 20) With {
.Value = txtMobileNo.Text.ToString()
}
ChangeCommand.Parameters.Add(MobileNumber)
' Telephone Number
Dim TelephoneNumber As New OleDbParameter("@TelephoneNumber", OleDbType.VarWChar, 20) With {
.Value = txtTelephoneNo.Text.ToString()
}
ChangeCommand.Parameters.Add(TelephoneNumber)
' Address
Dim Address As New OleDbParameter("@Address", OleDbType.VarWChar, 50) With {
.Value = txtStudentAddress1.Text.ToString()
}
ChangeCommand.Parameters.Add(Address)
' City
Dim City As New OleDbParameter("@City", OleDbType.VarWChar, 50) With {
.Value = txtStudentAddress2.Text.ToString()
}
ChangeCommand.Parameters.Add(City)
' Father Name
Dim FatherName As New OleDbParameter("@FName", OleDbType.VarWChar, 50) With {
.Value = txtFatherName.Text.ToString()
}
ChangeCommand.Parameters.Add(FatherName)
' Father Occupation
Dim Fatheroccupation As New OleDbParameter("@FOccupation", OleDbType.VarWChar, 30) With {
.Value = txtFatherOccupation.Text.ToString()
}
ChangeCommand.Parameters.Add(Fatheroccupation)
' Father Email
Dim FatherEmail As New OleDbParameter("@FEmail", OleDbType.VarWChar, 40) With {
.Value = txtFatherEmail.Text.ToString()
}
ChangeCommand.Parameters.Add(FatherEmail)
' Father Work Address
Dim FatherWorkAddress As New OleDbParameter("@FWorkAddress", OleDbType.VarWChar, 50) With {
.Value = txtFatherWorkAddress.Text.ToString()
}
ChangeCommand.Parameters.Add(FatherWorkAddress)
' Father Contact Number
Dim FatherContactNumber As New OleDbParameter("@FContactNumber", OleDbType.VarWChar, 20) With {
.Value = String.Format("{0:(0#) ##-###-####}", txtFatherContactNo.Text).ToString
}
ChangeCommand.Parameters.Add(FatherContactNumber)
' Mother Name
Dim MotherName As New OleDbParameter("@MName", OleDbType.VarWChar, 50) With {
.Value = txtMotherName.Text.ToString()
}
ChangeCommand.Parameters.Add(MotherName)
' Mother Occupation
Dim Motheroccupation As New OleDbParameter("@MOccupation", OleDbType.VarWChar, 30) With {
.Value = txtMotherOccupation.Text.ToString()
}
ChangeCommand.Parameters.Add(Motheroccupation)
' Mother Email
Dim MotherEmail As New OleDbParameter("@MEmail", OleDbType.VarWChar, 30) With {
.Value = txtMotherEmail.Text.ToString()
}
ChangeCommand.Parameters.Add(MotherEmail)
' Mother Work Address
Dim MotherWorkAddress As New OleDbParameter("@MWorkAddress", OleDbType.VarWChar, 40) With {
.Value = txtMotherWorkAddress.Text.ToString()
}
ChangeCommand.Parameters.Add(MotherWorkAddress)
' Mother Contact Number
Dim MotherContactNumber As New OleDbParameter("@MContactNumber", OleDbType.VarWChar, 20) With {
.Value = String.Format("{0:(0#) ##-###-####}", txtMotherContactNo.Text).ToString
}
ChangeCommand.Parameters.Add(MotherContactNumber)
' Number of Siblings
Dim NumberOfSiblings As New OleDbParameter("@NumOfSiblings", OleDbType.VarWChar, 10) With {
.Value = txtNoOfSiblings.Text.ToString()
}
ChangeCommand.Parameters.Add(NumberOfSiblings)
' Person in case of Emergency
Dim PersonEmergency As New OleDbParameter("@PersonEmergency", OleDbType.VarWChar, 15)
If rdoFather.Checked Then
PersonEmergency.Value = rdoFather.Text.ToString()
ElseIf rdoMother.Checked Then
PersonEmergency.Value = rdoMother.Text.ToString()
ElseIf rdoOthers.Checked Then
PersonEmergency.Value = rdoOthers.Text.ToString()
End If
ChangeCommand.Parameters.Add(PersonEmergency)
' Guardian Name
Dim GuardianName As New OleDbParameter("@GName", OleDbType.VarWChar, 50) With {
.Value = txtGuardianName.Text.ToString()
}
ChangeCommand.Parameters.Add(GuardianName)
' Guardian Relation
Dim GuardianRelation As New OleDbParameter("@GRelation", OleDbType.VarWChar, 25) With {
.Value = txtGuardianRelation.Text.ToString()
}
ChangeCommand.Parameters.Add(GuardianRelation)
' Guardian Email
Dim GuardianEmail As New OleDbParameter("@GEmail", OleDbType.VarWChar, 30) With {
.Value = txtGuardianEmail.Text.ToString()
}
ChangeCommand.Parameters.Add(GuardianEmail)
' Guardian Work Address
Dim GuardianWorkAddress As New OleDbParameter("@GWorkAddress", OleDbType.VarWChar, 40) With {
.Value = txtGuardianWorkAddress.Text.ToString()
}
ChangeCommand.Parameters.Add(GuardianWorkAddress)
' Guardian Contact Number
Dim GuardianContactNumber As New OleDbParameter("@GContactNumber", OleDbType.VarWChar, 20) With {
.Value = String.Format("{0:(0#) ##-###-####}", txtGuardianContactNo.Text).ToString
}
ChangeCommand.Parameters.Add(GuardianContactNumber)
' Fetcher Name
Dim FetcherName As New OleDbParameter("@FetcherName", OleDbType.VarWChar, 50) With {
.Value = txtFetcherName.Text.ToString()
}
ChangeCommand.Parameters.Add(FetcherName)
' Fetcher Contact Number
Dim FetcherContactNumber As New OleDbParameter("@FetcherContactNumber", OleDbType.VarWChar, 20) With {
.Value = String.Format("{0:(0#) ##-###-####}", txtFetcherContactNo.Text).ToString
}
ChangeCommand.Parameters.Add(FetcherContactNumber)
' Siblings of Student1
Dim SiblingsOfStudent1 As New OleDbParameter("@SiblingsOfStudent1", OleDbType.VarWChar, 50) With {
.Value = txtSiblingsofStudent1.Text.ToString()
}
ChangeCommand.Parameters.Add(SiblingsOfStudent1)
' Siblings of Student2
Dim SiblingsOfStudent2 As New OleDbParameter("@SiblingsOfStudent2", OleDbType.VarWChar, 50) With {
.Value = txtSiblingsofStudent1.Text.ToString()
}
ChangeCommand.Parameters.Add(SiblingsOfStudent2)
' Siblings of Student3
Dim SiblingsOfStudent3 As New OleDbParameter("@dSiblingsOfStudent340", OleDbType.VarWChar, 50) With {
.Value = txtSiblingsofStudent1.Text.ToString()
}
ChangeCommand.Parameters.Add(SiblingsOfStudent3)
' Siblings of StudentAge1
Dim SiblingsOfStudentAge1 As New OleDbParameter("@SiblingsOfStudentAge1", OleDbType.VarWChar, 10) With {
.Value = txtSiblingsAge1.Text.ToString()
}
ChangeCommand.Parameters.Add(SiblingsOfStudentAge1)
' Siblings of StudentAge2
Dim SiblingsOfStudentAge2 As New OleDbParameter("@SiblingsOfStudentAge2", OleDbType.VarWChar, 10) With {
.Value = txtSiblingsAge2.Text.ToString()
}
ChangeCommand.Parameters.Add(SiblingsOfStudentAge2)
' Siblings of StudentAge3
Dim SiblingsOfStudentAge3 As New OleDbParameter("@SiblingsOfStudentAge3", OleDbType.VarWChar, 10) With {
.Value = txtSiblingsAge3.Text.ToString()
}
ChangeCommand.Parameters.Add(SiblingsOfStudentAge3)
' Siblings of StudentSchool1
Dim SiblingsOfStudentSchool1 As New OleDbParameter("@SiblingsOfStudentSchool1", OleDbType.VarWChar, 40) With {
.Value = txtSiblingsSchool1.Text.ToString()
}
ChangeCommand.Parameters.Add(SiblingsOfStudentSchool1)
' Siblings of StudentSchool2
Dim SiblingsOfStudentSchool2 As New OleDbParameter("@SiblingsOfStudentSchool2", OleDbType.VarWChar, 40) With {
.Value = txtSiblingsSchool2.Text.ToString()
}
ChangeCommand.Parameters.Add(SiblingsOfStudentSchool2)
' Siblings of StudentSchool3
Dim SiblingsOfStudentSchool3 As New OleDbParameter("@SiblingsOfStudentSchool3", OleDbType.VarWChar, 40) With {
.Value = txtSiblingsSchool3.Text.ToString()
}
ChangeCommand.Parameters.Add(SiblingsOfStudentSchool3)
' School Last Attended1
Dim SchoolLastAttended1 As New OleDbParameter("@SchoolLastAttended1", OleDbType.VarWChar, 50) With {
.Value = txtSchoolLastAttended1.Text.ToString()
}
ChangeCommand.Parameters.Add(SchoolLastAttended1)
' School Last Attended2
Dim SchoolLastAttended2 As New OleDbParameter("@SchoolLastAttended2", OleDbType.VarWChar, 50) With {
.Value = txtSchoolLastAttended2.Text.ToString()
}
ChangeCommand.Parameters.Add(SchoolLastAttended2)
' School Last Attended3
Dim SchoolLastAttended3 As New OleDbParameter("@SchoolLastAttended3", OleDbType.VarWChar, 50) With {
.Value = txtSchoolLastAttended3.Text.ToString()
}
ChangeCommand.Parameters.Add(SchoolLastAttended3)
' Academic Year1
Dim AcademicYear1 As New OleDbParameter("@AcademicYear1", OleDbType.VarWChar, 20) With {
.Value = txtAcademicYear1.Text.ToString()
}
ChangeCommand.Parameters.Add(AcademicYear1)
' Academic Year2
Dim AcademicYear2 As New OleDbParameter("@AcademicYear2", OleDbType.VarWChar, 20) With {
.Value = txtAcademicYear2.Text.ToString()
}
ChangeCommand.Parameters.Add(AcademicYear2)
' Academic Year3
Dim AcademicYear3 As New OleDbParameter("@AcademicYear3", OleDbType.VarWChar, 20) With {
.Value = txtAcademicYear3.Text.ToString()
}
ChangeCommand.Parameters.Add(AcademicYear3)
' Reason for Applying
Dim ReasonApplying As New OleDbParameter("@ReasonApplying", OleDbType.VarWChar, 500) With {
.Value = txtReasonApplying.Text.ToString()
}
ChangeCommand.Parameters.Add(ReasonApplying)
Dim MemStream As New MemoryStream
Dim StudentPic_Update As Byte()
StudentPic.Image.Save(MemStream, Imaging.ImageFormat.Png)
StudentPic_Update = MemStream.GetBuffer()
MemStream.Read(StudentPic_Update, 0, MemStream.Length)
' image content
Dim StudentIDPic As New OleDbParameter("@SPic", SqlDbType.Image) With {
.Value = StudentPic_Update
}
ChangeCommand.Parameters.Add(StudentIDPic)
If ChangeCommand.ExecuteNonQuery() Then
ChangeConnection.Close()
MsgBox("Your info updated successfully... ", MsgBoxStyle.Information, "Record Updated")
PictureBox1.Visible = False
Panel1.Visible = False
PictureBox2.Visible = False
btnNext.Text = " Change "
Subject()
Else
MsgBox("Your info modification failed ", MsgBoxStyle.Critical, "Change Failed")
Return
End If
ElseIf btnNext.Text = "Next" Then
Dim NextConnection As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database\Pre-enrollment.accdb")
If NextConnection.State = ConnectionState.Open Then NextConnection.Close()
NextConnection.Open()
Dim NextString As String = "insert into EnrollmentData(StudentNumber,GradeLevel,Strand,Semester,SchoolYear,Lastname,Firstname,Middlename,Age,DOB,Sex,POB,Nationality,Religion,Email,MobileNumber,TelephoneNumber,Address,City,FatherName,FatherOccupation,FatherEmail,FatherWorkAddress,FatherContactNumber,MotherName,MotherOccupation,MotherEmail,MotherWorkAddress,MotherContactNumber,NumberOfSiblings,PersonEmergency,GuardianName,GuardianRelation,GuardianEmail,GuardianWorkAddress,GuardianContactNumber,FetcherName,FetcherContactNumber,SiblingsOfStudent1,SiblingsOfStudent2,SiblingsOfStudent3,SiblingsOfStudentAge1,SiblingsOfStudentAge2,SiblingsOfStudentAge3,SiblingsOfStudentSchool1,SiblingsOfStudentSchool2,SiblingsOfStudentSchool3,SchoolLastAttended1,SchoolLastAttended2,SchoolLastAttended3,AcademicYear1,AcademicYear2,AcademicYear3,ReasonApplying,Identifier,StudentPicture,Status) values(@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8,@d9,@d10,@d11,@d12,@d13,@d14,@d15,@d16,@d17,@d18,@d19,@d20,@d21,@d22,@d23,@d24,@d25,@d26,@d27,@d28,@d29,@d30,@d31,@d32,@d33,@d34,@d35,@d36,@d37,@d38,@d39,@d40,@d41,@d42,@d43,@d44,@d45,@d46,@d47,@d48,@d49,@d50,@d51,@d52,@d53,@d54,@d55,@d56,@d57)"
Dim NextCommand As New OleDbCommand(NextString, NextConnection)
' Student Number
Dim StudentNumber As New OleDbParameter("@d1", OleDbType.VarWChar, 30) With {
.Value = txtStudentNumber.Text.ToString()
}
NextCommand.Parameters.Add(StudentNumber)
' Grade Level
Dim GradeLevel As New OleDbParameter("@d2", OleDbType.VarWChar, 30) With {
.Value = cmbGradeLevel.Text.ToString()
}
NextCommand.Parameters.Add(GradeLevel)
' Strand
Dim Strand As New OleDbParameter("@d3", OleDbType.VarWChar, 70) With {
.Value = cmbStrand.Text.ToString()
}
NextCommand.Parameters.Add(Strand)
' Semester
Dim Semester As New OleDbParameter("@d4", OleDbType.VarWChar, 30) With {
.Value = cmbSemester.Text.ToString()
}
NextCommand.Parameters.Add(Semester)
' School Year
Dim SchoolYear As New OleDbParameter("@d5", OleDbType.VarWChar, 30) With {
.Value = cmbSchoolYear.Text.ToString()
}
NextCommand.Parameters.Add(SchoolYear)
' Lastname
Dim Lastname As New OleDbParameter("@d6", OleDbType.VarWChar, 30) With {
.Value = txtLastname.Text.ToString()
}
NextCommand.Parameters.Add(Lastname)
' Firstname
Dim Firstname As New OleDbParameter("@d7", OleDbType.VarWChar, 30) With {
.Value = txtFirstname.Text.ToString()
}
NextCommand.Parameters.Add(Firstname)
' Middlename
Dim Middlename As New OleDbParameter("@d8", OleDbType.VarWChar, 30) With {
.Value = txtMiddlename.Text.ToString()
}
NextCommand.Parameters.Add(Middlename)
' Age
Dim Age As New OleDbParameter("@d9", OleDbType.VarWChar, 10) With {
.Value = txtAge.Text.ToString()
}
NextCommand.Parameters.Add(Age)
' Date of Birth
Dim DOB As New OleDbParameter("@d10", OleDbType.Date, 15) With {
.Value = dtpDOB.Text.ToString()
}
NextCommand.Parameters.Add(DOB)
' Sex
Dim Sex As New OleDbParameter("@d11", OleDbType.VarWChar, 15)
If rdoMale.Checked Then
Sex.Value = rdoMale.Text.ToString()
ElseIf rdoFemale.Checked Then
Sex.Value = rdoFemale.Text.ToString()
End If
NextCommand.Parameters.Add(Sex)
' Place of Birth
Dim POB As New OleDbParameter("@d12", OleDbType.VarWChar, 30) With {
.Value = txtPOB.Text.ToString()
}
NextCommand.Parameters.Add(POB)
' Nationality
Dim Nationality As New OleDbParameter("@d13", OleDbType.VarWChar, 30) With {
.Value = txtNationality.Text.ToString()
}
NextCommand.Parameters.Add(Nationality)
' Religion
Dim Religion As New OleDbParameter("@d14", OleDbType.VarWChar, 30) With {
.Value = txtReligion.Text.ToString()
}
NextCommand.Parameters.Add(Religion)
' Email
Dim Email As New OleDbParameter("@d15", OleDbType.VarWChar, 40) With {
.Value = txtEmail.Text.ToString()
}
NextCommand.Parameters.Add(Email)
' Mobile Number
Dim MobileNumber As New OleDbParameter("@d16", OleDbType.VarWChar, 20) With {
.Value = String.Format("{0:(0#) ##-###-####}", txtMobileNo.Text).ToString
}
NextCommand.Parameters.Add(MobileNumber)
' Telephone Number
Dim TelephoneNumber As New OleDbParameter("@d17", OleDbType.VarWChar, 20) With {
.Value = txtTelephoneNo.Text.ToString()
}
NextCommand.Parameters.Add(TelephoneNumber)
' Address
Dim Address As New OleDbParameter("@d18", OleDbType.VarWChar, 50) With {
.Value = txtStudentAddress1.Text.ToString()
}
NextCommand.Parameters.Add(Address)
' City
Dim City As New OleDbParameter("@d19", OleDbType.VarWChar, 50) With {
.Value = txtStudentAddress2.Text.ToString()
}
NextCommand.Parameters.Add(City)
' Father Name
Dim FatherName As New OleDbParameter("@d20", OleDbType.VarWChar, 50) With {
.Value = txtFatherName.Text.ToString()
}
NextCommand.Parameters.Add(FatherName)
' Father Occupation
Dim Fatheroccupation As New OleDbParameter("@d21", OleDbType.VarWChar, 30) With {
.Value = txtFatherOccupation.Text.ToString()
}
NextCommand.Parameters.Add(Fatheroccupation)
' Father Email
Dim FatherEmail As New OleDbParameter("@d22", OleDbType.VarWChar, 40) With {
.Value = txtFatherEmail.Text.ToString()
}
NextCommand.Parameters.Add(FatherEmail)
' Father Work Address
Dim FatherWorkAddress As New OleDbParameter("@d23", OleDbType.VarWChar, 50) With {
.Value = txtFatherWorkAddress.Text.ToString()
}
NextCommand.Parameters.Add(FatherWorkAddress)
' Father Contact Number
Dim FatherContactNumber As New OleDbParameter("@d24", OleDbType.VarWChar, 20) With {
.Value = String.Format("{0:(0#) ##-###-####}", txtFatherContactNo.Text).ToString
}
NextCommand.Parameters.Add(FatherContactNumber)
' Mother Name
Dim MotherName As New OleDbParameter("@d25", OleDbType.VarWChar, 50) With {
.Value = txtMotherName.Text.ToString()
}
NextCommand.Parameters.Add(MotherName)
' Mother Occupation
Dim Motheroccupation As New OleDbParameter("@d26", OleDbType.VarWChar, 30) With {
.Value = txtMotherOccupation.Text.ToString()
}
NextCommand.Parameters.Add(Motheroccupation)
' Mother Email
Dim MotherEmail As New OleDbParameter("@d27", OleDbType.VarWChar, 30) With {
.Value = txtMotherEmail.Text.ToString()
}
NextCommand.Parameters.Add(MotherEmail)
' Mother Work Address
Dim MotherWorkAddress As New OleDbParameter("@d28", OleDbType.VarWChar, 40) With {
.Value = txtMotherWorkAddress.Text.ToString()
}
NextCommand.Parameters.Add(MotherWorkAddress)
' Mother Contact Number
Dim MotherContactNumber As New OleDbParameter("@d29", OleDbType.VarWChar, 20) With {
.Value = String.Format("{0:(0#) ##-###-####}", txtMotherContactNo.Text).ToString
}
NextCommand.Parameters.Add(MotherContactNumber)