0% found this document useful (0 votes)
678 views

Pre-Enrollment Management System

Final Thesis Paper titled "Pre-Enrollment Management System" Github: https://github.com/PP-Namias/Pre-enrollment-Management-System
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
678 views

Pre-Enrollment Management System

Final Thesis Paper titled "Pre-Enrollment Management System" Github: https://github.com/PP-Namias/Pre-enrollment-Management-System
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 309

YOUNG ACHIEVERS’ SCHOOL OF CALOOCAN INC.

No. 7 Ramos Compound Bagumbong, Caloocan City

A Capstone project titled:

Pre-Enrollment Management System for


Young Achievers’ School of Caloocan Inc.

Presented by:
Group 1

Badong, Adrian
Balod, Shereen Jeouel
Legaspi, John Benedict
Manalo, Allen
Meru, John Carl
Namias, Jhon Keneth Ryan B.
Palahang, Jun Mark
Tuazon, Kaye

Grade 12 - ICT 2

SY: 2021 - 2022


YOUNG ACHIEVERS’ SCHOOL OF CALOOCAN INC.
No. 7 Ramos Compound Bagumbong, Caloocan City

A Capstone project titled:

Pre-Enrollment Management System for


Young Achievers’ School of Caloocan Inc.

Presented by:
Group 1

Badong, Adrian
Balod, Shereen Jeouel
Legaspi, John Benedict
Manalo, Allen
Meru, John Carl
Namias, Jhon Keneth Ryan B.
Palahang, Jun Mark
Tuazon, Kaye

Grade 12 - ICT 2

SY: 2021 - 2022


Approval Sheet

This research paper here to entitled:


Pre-Enrollment Management System for Young Achievers’ School of Caloocan Inc. SY. 2021-
2022

Prepared and submitted by Adrian Badong, Allen Manalo, Jhon Keneth Namias, John Benedict
Legaspi, John Carl Meru, Jun Mark Palahang, Kaye Tuazon, Shereen Jeouel Balod. in fulfillment
of the requirements for Computer Programming has been examined and is recommended for
acceptance and approval for oral defense.

Mr. Ranilio David Mr. Chrysler Indigo Panaguiton


Capstone Project Adviser Capstone Project Consultant

Examined and Passed

Passed the Comprehensive Examination:

Accepted and approved in partial fulfillment for the applied subject inquiries and investigation.

Page | I
ACKNOWLEDGEMENT

The completion of this study could not have been possible without the expertise of Mr. Ranilio
David, our Capstone Project Adviser and Mr. Chrysler Indigo Panaguiton, our Capstone Project
Consultant. We wish to express our sincere gratitude to them for providing us an opportunity to
do this research paper effectively.

This success of us couldn’t turn into reality without this following person who with all their help
in different ways. To all of you, let me acknowledge everyone, all assign of my department of
gratitude to our Almighty God who always guide and light our way in this research, without Him,
we can do nothing in the world.

We also thank the attentive and courageous respondents to allow us to interview them without
hesitations and for showing a respect, while doing this respective paper. We should keep up the
good work and thereafter when we should be pursuing our respect.

Page | II
Table of Contents
Approval Sheet I
Acknowledgement II
Table of Contents III

Chapter 1, Introduction 1-6


1.1 Introduction 1-2
1.2 Statement of the Problem 3
1.3 Purpose/Objective of the Project 3
1.4 Significance of the Project 4
1.5 Scope and Delimitation 4
1.6 Conceptual Framework 5-6
1.7 Definition of Terms 6
1.8 Hypothesis 6

Chapter 2, Review of Related Literature 7-8


2.1 Foreign Literature 7
2.2 Local Literature 7-8
2.3 Foreign Study 8
2.4 Local Study 8

Chapter 3, Research, Design and Methodology 9-10


3.1 Research Design 9
3.2 Sampling Procedure 9
3.3 Participants of the Study 9
3.4 Data Gathering Procedure 9
3.5 Research Instrument 9
3.6 Statistical Treatment 10

Chapter 4, Results and Discussions 11-57


4.1 Presentation, Analysis, and Interpretation of Data 11-25
4.2 Graphical User Interface 26-57

Chapter 5, Conclusions and Recommendations 58-60


5.1 Summary 58-59
5.2 Conclusion 60
5.3 Recommendation 60

References 61
Appendices 62-78
Questionnaire 79-80
Flowchart 81-84
Source Code 85-292
Curriculum Vitae 293-304

Page | III
Young Achievers’ School of Caloocan, Inc.
Senior High School S.Y. 2021-2022
#7 Ramos Compound, Bagumbong, Caloocan City

Research Output

Date: April 4, 2022 Doc. Ref #:


Name of Proponents
Adrian Badong
Allen Manalo
Jhon Keneth Namias
John Benedict Legaspi
John Carl Meru
Jun Mark Palahang
Kaye Tuazon
Shereen Jeouel Balod

Proposed Title
Pre-Enrollment Management System for
Young Achievers’ School of Caloocan Inc.

Chapter 1 – Introduction

In this part of the research, it will provide discussions of the Background of the Project,
Purpose and Description, Statement of the Problem, Purpose/ Objective of the Project,
Significance of the Study, Scope and Delimitation, Conceptual Framework, Definition of
Terms, Hypothesis.

A system for processing, storing, and managing student enrolment data. This system's real-time
logging allows it to easily record the time-in and time-out of a user's attendance. It has a simple
user interface for quick record processing and logging. It also includes a picture of each user to
guarantee the person's identification while logging in. This program is useful for schools, as
they keep a large database of students' information and attendance records. I hope you enjoy this
system.

Page | 1
Background of the Project
Nowadays, technology plays a significant part in our lives. The fast expansion of
technology can be seen everywhere. Computer technologies are one of the most rapidly
evolving technologies, particularly since they can make our job easier, more organized, and
easier than the traditional methods of writing and computing data. All of this, with or without
our knowledge, leads to numerous unimaginable computer capabilities. And we cannot argue
that computer technology can make a modern man's living more convenient.

Initially, apps might be a means to take use of today's technology in order to improve the
efficiency and security of businesses. Most businesses nowadays rely on applications that
provide them with more convenient access to their company information at any time and from
any location. Applications have come a long way and now provide competitive benefits over
conventional software-based systems, allowing organizations to consolidate and simplify their
systems and processes while also lowering costs.

The researchers will submit a project that intends to develop a secure, user-friendly, and easy-
to-modify program called the ‘Pre-Enrollment Management System for Young Achievers'
School of Caloocan Inc. SY. 2021-2022’.

We were committed to create the aforementioned system, which would provide efficiency,
more accurate results, and the capacity to quickly search for and update information as needed.
Using the aforementioned technologies, easy sorting and monitoring of pre- enrollment data
will be available. It will also generate reference id for students who are presently enrolled. The
proposed system will be utilized by IT personnel, Teachers, and Students.

The ‘Pre-Enrollment Management System for Young Achievers’ School of Caloocan Inc. SY.
2021-2022’ aims to automate almost all of the processes mentioned above in order to reduce
the clerical labor of the school's staff working in both technical and accounting departments
and it enables sorting and archiving of data and promotes efficient administration and
management of the records by utilizing specialized algorithms and cost-effective tools, thereby
providing better control to management by avoiding manual errors, etc.

Page | 2
Statement of the Problem

The current enrollment system of Young Achievers' School of Caloocan Inc. is done at an
online portal for aspiring Yascians, but this portal is not only commercially billed, but it also
lacks features such as security, user-friendliness, and inefficiency in processing the students'
records and data. Too much time and effort are wasted and cannot be delivered on time. The
researcher aimed to find an answer to the following question:

1. What programming language did the programmer use to develop this program?
2. What colour scheme is used by the programmer?
3. What database management system does the programmer employ?
4. In terms of layout and design, does the system pass?
5. Is it simple to use the system?
6. Is it a user-friendly system?
7. Is the security of the system competent?
8. In terms of reliability, is the system accepted?
9. Is the system dependable and trustworthy?
10. Is the system unique and creative?

Purpose/ Objective of the Project

The primary goal of the project is to reduce the amount of human labor necessary to do all
essential tasks such as maintaining a record of all the students, pre-enrollment, database
management, and so on.

Specifically, this study aims to meet the following:


• To develop a pre-enrollment system for all aspiring students at Young Achievers’
School of Caloocan.
• To automate the Pre-enrollment process and student’s reference number generation.

Page | 3
Significance of the Project

Computers bring convenience to its users by making transactions easier and faster. Because the
number of students in practically all educational institutions is quickly expanding, there is a
greater demand for teachers. Fortunately, today's generation of high-tech machines and tools
can take the place of these employees. This capstone project “Pre-Enrollment Management
System for Young Achievers’ School of Caloocan Inc. SY. 2021-2022” will provide a high-
tech system of collecting and monitoring student data, making the pre-enrollment process more
comfortable for both students and parents.

This study will be beneficial to the following entities:


Principal - This study will help the principal to monitor the enrollment performance.

Administrators - This study will help them to monitor the records and forecast the tools needed
for incoming school year. It will help to keep and handle essential information of the student for
the convenience of the students and the personnel assign to enrollment in the education
institution.

Teachers - This research will help teachers in determining the best approach to assess student
enrollment.

Future Researcher - This study will help the researcher to gain more knowledge and
information about this capstone project.

Potential Students – can easily apply and pre-enroll here at Young Achievers' School of
Caloocan Inc. They will know how pre-enrollment management system works

Scope and Delimitation

The program database will store the personal Information of the learners such as last name, first
name, middle name, address, date of birth, age, sex, religion, father name, mothers name, type
of transportation when entering school, grade level you want to study, administrator and
registrar signature and date of birth, learner’s signature and date of birth, learner’s username,
and password. The program also allows for the uploading of a learner's picture.

Delimitation
The system is exclusively for Young Achievers’ School of Caloocan Inc. The system will not
include the viewing of the Administrator personal information. Quizzes and recitations of
learners are not available in the system. Learners are only allowed to view their profile and
cannot be edited.

Page | 4
Conceptual Framework

•Program
REQUIREMENTS •Requirements
•Documentation

DESIGN •Software Design/ layout

IMPLEMENTATION •Programing

VERIFICATION •System testing

MAINTENANCE

Requirements:
The first phase entails determining what needs to be created as well as its function, purpose,
and so on. The input and output specifications, as well as the final product specifications, are
analyzed and marked here.

System Design:
This phase studies the need specifications from the previous phase and prepares the system
design. System design assists in the specification of hardware and system requirements, as well
as the definition of overall system architecture. The software code that will be written in the
following step is being written right now.

Implementation:
The system is first built-in discrete programs called units, with feedback from system design,
and then merged into the next step. Unit Testing is the process through which each unit is
designed and tested for functioning.

Verification (Integration and Testing):


During the implementation phase, all of the components that were produced are merged into a
single system. After each product has been thoroughly tested. The program that is produced
must meet that standard. Constant software testing to identify flaws and problems. Testing is
required to guarantee that the user has no difficulties with the program installation

Page | 5
Maintenance:
This stage happens after installation and entails making changes to the system or a single
component to change qualities or enhance performance. These changes occur as a result of
either user-initiated change requests or problems discovered during live system operation. The
produced software is regularly maintained and supported for the user. All of these stages are
connected in such a way that progress is considered to flow smoothly downhill (like a waterfall)
through the phases. The next phase begins only once the preceding phase's established set of
goals has been met and signed off, thus the term "Waterfall Model".

Definition of Terms

The following terms need to be explained in order to understand the terminologies used in
research: (Conceptually & Operationally)

Pre-enrollment. It’s a procedure that students applied in but it’s not fully enrolled yet.
School Management System. A system that aids in the evaluation and search of enormous
amounts of data and is mostly used to handle large amounts of data.
System Standard. Our programmer designed the program to be easy to use, user-friendly, and
adapt for the school, making it easier to use and manage data.
Enrollment portal. This is where aspiring applicants fill out their information in order to be
enrolled.
System making procedure. It comprised of Requirements, Design, Implementation,
Verification, and Maintenance in order to make the system easier to develop and maintain rather
than a chaotic mess at the development stage, making it more vulnerable to bugs, errors, and
other issues.

Hypothesis

There is a no significance in the improvement of the enrollment system as compared to the


online enrollment of Young Achievers' School of Caloocan, Inc.

Page | 6
Chapter 2 – Review of Related Literature

The following proposed system is discussed in this chapter. The project's aim is to create an
enrollment system for Young Achievers' School of Caloocan, Inc. This system is designed for
use by staff to enable them to create information necessary by different persons and may also
be used to automatically pre-enroll applicants. It also includes information pertinent data such
as name, grade level, school year, guardian, contact number/s, and etc.

Foreign Literature
According to Rowley (2005), an enrollment system is often classified as an information
system, and it acts as a tool to assist information management in terms of student data,
enrollment fees information, and other information related to the enrolling process. Every
school gains a competitive edge by implementing this system since they will be able to handle
sensitive information with simplicity and security.

According to Dunn and Scott (2005), the enrolment system has had a significant influence on
the educational setting. It is a system based on creative program strategies. It is a method that
will assist both the enrollment employees in charge and the students in completing the enrolling
procedure in less time. Unlike conventional enrolling, the LAN enrollment system processes a
huge number of student data and offers effective and consistent information services.

According to Sybex Inc (1999), visual basic provides a graphical environment in which users
typically develop the forms and controls that comprise the basic components of the tour
application. Visual Basic has a plethora of helpful features that will increase the user's
productivity. According to Gold Chager et al. (2003), computer as a device for processing the
information understood computer plays an important part in their life, but few are aware of how
ubiquitous role is. According to Mane (2000), the invention of the computer made it simpler to
complete that by doing it manually, to have direct access on easy answer merely monitoring
record where in the demands of computer make it possible for everyone to receive data in a
specific need. We can think of the computer as a necessary and productive tool for individuals.
According to Gurewich (1999), the database system speeds up the operation of every
organization. Because, instead of completing things manually, computer technology allows
everything to be done more quickly.

Local Literature
According to Dioso (2011), computers aid in comprehensive intelligent planning,
organizing, actuating, and controlling. This can be seen in the past when they monitor
production processes, solve scientific problems, and help arrive at preliminary answers to a
variety of involved situations. According to Ralph M. Stair (2009), technological advancements
over time have enabled us to accomplish more with less effort. From the invention of the light
bulb through the industrial revolution and beyond, humans have been striving for a more
efficient way of carrying out activities. Furthermore, according to Ilagan (2010), Far Eastern

Page | 7
University (FEU) is one of the largest institutions in the country in terms of population, with
over 25,000 students.

With a huge population comes plenty of issues with enrollment, student records, and related
data. FEU sought advice from professionals in order to find a long-term solution to the situation.
As a result, the decision was made to automate FEU's enrollment method. FEU opted to
automate the enrollment system in two stages: (1) the development of an enrollment and student
records system for Phase I, and (2) the integration of student financial data for Phase II. They
collaborated closely with SQL*Wizard to test E*Wizard, an integrated student enrollment
system that includes modules with broad inquiry and reporting capability.

They also enlisted the help of FEU's Computer Services Department to work out any glitches.
They analyzed organizational structures, allocated people to support groups, and requested
training from faculty advisers and employees. She also met with representatives from each
institute and plotted the introduction of an integrated system during the second semester with
the help of academic management and SQL*Wizard's technical department. Cleaning the
database, standardizing topic labels, and establishing the subject requirements were all part of
the preparation.

Foreign Study
A software development and IT service provider built their catalyst integrated web
platform to give the two rice schools with content management, transaction processing,
marketing, and interactive community functions. Catalyst meets the Jones School's two key
requirements for choosing a web-based platform: it simplifies content administration and allows
users to respond to information such as event RSVP and course registration. The content
management tools enable the Jones school personnel to edit, update, and contribute to the
amount of curriculum and event material without requiring technical support. They just copy
and paste the document into the content management system, check it for correctness, then
publish it to the web.

Local Study
According to the researcher, an internet enrolment system for Veritas Parochial School
(VPS) in Manila was developed to assist its students in enrolling in a more efficient way without
the hassles of waiting long hours to fill out forms that sometimes become redundant, or standing
in line and paying at the cashier. This new kind of enrolling is possible with the Internet
enrollment system for VPS. This new system provides students with more choices for registering
at VPS. By entering into the VPS website, students may register for and enroll in courses for the
upcoming academic year. With these, all students are expected to fill out forms that take no
more than a few minutes to complete. For future reference, the system saves its records in the
school database. Confirmation of student transactions must be confirmed, and tuition costs must
be paid through the school's registrar. Students can also explore the VPS website and check their
current account balance.

Page | 8
Chapter 3 – Research Design and Methodology

This chapter focused on the methodology that was used in the study. It dealt with research design,
sampling procedure, participants of the study, data gathering procedure, research instrument, and
statistical treatment.

Research Design
For this study, the researcher surveyed Grade 11 Information and Communications Technology
students at Young Achievers School of Caloocan. The researcher applied a descriptive survey
approach in their research, and observations were used as descriptive methods. The researcher
will solicit responses from Grade 11 ICT students at Young Achievers School in Caloocan in
order to distribute the questionnaire through the descriptive survey approach. Using this
approach, the researcher will find it simple to collect data.

Sampling Procedure
The researchers used Purposive Sampling in administering questionnaires to the section ICT of
Grade 11 level at Young Achievers’ of Caloocan as respondents. We employ Purposive
sampling, also known as judgmental, selective, or subjective sampling, since it is a type of non-
probability sampling in which we researchers depend on our own judgment when selecting
people of the public to participate in our surveys.

Participants of the Study


This study will focus on Grade 11 ICT students who are currently enrolled in Young Achievers’
School of Caloocan, SY 2021 – 2022 and the researchers will present to them the system. The
researchers used the survey data of 30 ICT students who took part in the survey.

Data Gathering Procedure


The researchers utilized simple random sampling to identify the respondents among the students
in this study and the researcher conducted a survey to be answered by selected respondents.
Before the researchers give the survey, they first ask their teacher for permission to complete the
survey for their research. The study employed simple random selection to choose 30 students,
respectively.

Research Instrument
The instrument used in the study was a two-part questionnaire prepared by our capstone project
consultant. The first part of the questionnaire focuses on ‘System Features’ such as layout and
design, ease of use, user friendliness, security, reliability, and creativity and originality using a
6-point Likert scale ranging from 1 - Very poor to 6 - Highest. The second part focuses on how
the presenter presented the system to the Grade 11 ICT students, using again a 6-point Likert
scale ranging from 1 - Very poor to 6 - Highest.

Page | 9
Statistical Treatment
Before the data was tabulated and statistical analysis began, individual replies were recorded on
tally sheets. The data obtained on the conducted tests was treated with the following formula in
order to generate solutions for the study's treatment of the problem. Following the data
collection, the information acquired will be tabulated, analyzed, and interpreted by the
researchers using the statistical methods and procedures listed below.

1. Frequency and percentage. This was used to summarize the data gathered from the
survey questionnaire the respondents will answer.
2. Mean. will be used to get average score of the respondent's answer.
∑𝑥
Formula: 𝑋 = 𝑁
Where:
𝑋 = Mean,
∑ 𝑥 = sum of all scores, and
𝑁 = Number of cases

Page | 10
Chapter 4 – Results and Discussions

Presentation, Analysis, and Interpretation of Data


This chapter is dedicated to presenting the analysis and interpretation of data that the researchers
gathered for the results. Results will be followed by a discussion of search findings. The findings
relate to the research questions that guided the study. Data were analyzed to identify, describe,
and examine the Statistics about the System and Statistics based on the performance on
presentation day for research paper “Pre-Enrollment Management System for Young Achievers’
School of Caloocan Inc. SY. 2021-2022”.

Section I - Statistics about the System


Table 1: Layout and Design (Text, Fonts are easy to read and clear, Colors are matching No
space wasted)
CHOICES f Percentage (%)
1 - Very poor 0 0%
2 - Poor 0 0%
3 - Average 4 13%
4 - Above Average 3 10%
5 - Satisfactory 9 30%
6 - Highest 14 47%

Mean: 5.1
Graph 1: Layout and Design (Text, Fonts are easy to read and clear, Colors are matching No
space wasted)

Graph 1. With a mean of 5.1, the layout and design are outstanding. This indicates that
respondents are quite satisfied, and it has become an essential part of the system. The alternative
hypothesis is accepted

Page | 11
Table 2: Ease of Use – (Functions of the system are easy to use)
CHOICES f Percentage (%)
1 - Very poor 0 0%
2 - Poor 0 0%
3 - Average 1 3%
4 - Above Average 5 17%
5 - Satisfactory 12 40%
6 - Highest 12 40%

Mean: 5.17

Graph 2: Ease of Use – (Functions of the system are easy to use)

Graph 2 The Ease of Use is remarkable, with a mean rating of 5.17. This shows that respondents
find the system to be very easy to use, and it has become an important component of the system.
The alternative hypothesis is accepted

Insights:
• 26% of people answered 6 - Highest for this question, and the majority answered "6 -
Highest" for Question 1.

Page | 12
• 26% of people answered 6 - Highest for this question, and the majority answered "6 -
Highest" for Question 3.

Page | 13
Table 3: User friendliness – (End-User can easily understand the system or program)
CHOICES f Percentage (%)
1 - Very poor 0 0%
2 - Poor 0 0%
3 - Average 2 7%
4 - Above Average 3 10%
5 - Satisfactory 10 33%
6 - Highest 15 50%

Mean: 5.27

Graph 3: User friendliness – (End-User can easily understand the system or program)

Graph 3 With a mean rating of 5.27, user friendliness is exceptional. This indicates that
respondents consider the system to be very user-friendly and understandable, and that it has
become an important part of the system. The alternative hypothesis is accepted

Page | 14
Table 4: Security – (Authentication and level of access)
CHOICES f Percentage (%)
1 - Very poor 0 0%
2 - Poor 0 0%
3 - Average 2 6.67%
4 - Above Average 8 26.67%
5 - Satisfactory 6 20%
6 - Highest 14 46.67%

Mean: 5.07

Graph 4: Security – (Authentication and level of access)

Graph 4 Security rates exceptionally well, with a mean rating of 5.07. This shows that
respondents believe the system is very secure, and the degree of access is very rational, and that
it has become a critical component of the system. The alternative hypothesis is accepted

Page | 15
Table 5: Reliability – (No downtime, and No DEBUG)
CHOICES f Percentage (%)
1 - Very poor 0 0%
2 - Poor 0 0%
3 - Average 2 7%
4 - Above Average 4 13%
5 - Satisfactory 11 37%
6 - Highest 13 43%

Mean: 5.17

Graph 5: Reliability – (No downtime, and No DEBUG)

Graph 5 With a mean rating of 5.17, reliability scores remarkably well. This demonstrates that
respondents believe the system has no downtime or DEBUG, is extremely reliable, and has
become an essential component of the system. The alternative hypothesis is accepted

Page | 16
Table 6: Dependability
CHOICES f Percentage (%)
1 - Very poor 0 0%
2 - Poor 0 0%
3 - Average 1 3.33%
4 - Above Average 9 30%
5 - Satisfactory 7 23.33%
6 - Highest 13 43.33%

Mean: 5.07

Graph 6: Dependability

Graph 6 Dependability ranks quite well, with a mean rating of 5.07. This shows that
respondents believe the system is very dependable, and that it has become an important part of
the system. The alternative hypothesis is accepted

Insights:
• 13% of people answered 3 - Average for this question, and the majority answered "3 -
Average" for Question 7.

Page | 17
• 13% of people answered 3 - Average for this question, and the majority answered "3 -
Average" for Question 2.

Page | 18
Table 7: Creativity and Originality – (Buttons, Icons, Images used in the program are original)
CHOICES f Percentage (%)
1 - Very poor 0 0%
2 - Poor 0 0%
3 - Average 2 6.67%
4 - Above Average 4 13.33%
5 - Satisfactory 8 26.67%
6 - Highest 16 53.33%

Mean: 5.27

Graph 7: Creativity and Originality – (Buttons, Icons, Images used in the program are original)

Graph 7 With a mean rating of 5.27, creativity and originality do pretty well. This demonstrates
that respondents believe the creative and unique are key parts of the system. The alternative
hypothesis is accepted

Page | 19
Section II – Statistics based on the performance on the presenting day
Table 8: Do you understand the presentation?
CHOICES f Percentage (%)
1 – Very poor 0 0%
2 – Poor 0 0%
3 – Average 3 10%
4 – Above Average 4 13.33%
5 – Satisfactory 8 26.67%
6 – Highest 15 50%

Mean: 5.17

Graph 8: Do you understand the presentation?

Graph 8 According to the respondents, with a mean comprehension rating of 5.17, they are very
well during the presentation of the system. This demonstrates that the audience has a good
understanding of the system. The alternative hypothesis is accepted

Page | 20
Table 9: Are you satisfied with the program or project presented?
CHOICES f Percentage (%)
1 - Very poor 0 0%
2 - Poor 0 0%
3 - Average 0 0%
4 - Above Average 5 16.67%
5 - Satisfactory 6 20%
6 - Highest 19 63.33%

Mean: 5.47

Graph 9: Are you satisfied with the program or project presented?

Graph 9 This is the question with the most points, with a mean rating of 5.47, indicating that
the respondents are very impressed with the system and project presented. The alternative
hypothesis is accepted

Page | 21
Table 10: Are the presenters well knowledgeable about their program?
CHOICES f Percentage (%)
1 - Very poor 0 0%
2 - Poor 0 0%
3 - Average 1 3.33%
4 - Above Average 4 13.33%
5 - Satisfactory 10 33.33%
6 - Highest 15 50%

Mean: 5.3

Graph 10: Are the presenters well knowledgeable about their program?

Graph 10 With a mean rating of 5.3, this is the most popular question, showing that the
respondents are quite impressed with the presenters' understanding of their program. The
alternative hypothesis is accepted

Insights:
• 13% of people answered 3 - Average for this question, and the majority answered "3 -
Average" for Question 8.

Page | 22
• 13% of people answered 3 - Average for this question, and the majority answered "3 -
Average" for Question 4.

Page | 23
Table 11: Are your questions/thoughts were answered?
CHOICES f Percentage (%)
1 - Very poor 0 0%
2 - Poor 0 0%
3 - Average 3 10%
4 - Above Average 2 6.67%
5 - Satisfactory 13 43.33%
6 - Highest 12 40%

Mean: 5.13

Graph 11: Are your questions/thoughts were answered?

Graph 11 Respondents were quite impressed after the presenters answered their
questions/thoughts, with a mean rating of 5.13, indicating that they were impressed. The
alternative hypothesis is accepted

Insights:
• 26% of people answered 6 - Highest for this question, and the majority answered "6 -
Highest" for Question 3.

Page | 24
• 26% of people answered 6 - Highest for this question, and the majority answered "6 -
Highest" for Question 9.

Page | 25
Graphical User Interface

Figure 1: Login Form 1.1

Page | 26
Figure 2: Login Form 1.2

Page | 27
Figure 3: Forgot Password

Page | 28
Figure 4: Main Form (Guest)

Page | 29
Figure 5: Main Form (Teacher)

Page | 30
Figure 6: Main Form (Admin)

Page | 31
Figure 7: Main Form (Super Admin)

Page | 32
Figure 8: Enrollment Portal (Step 1)

Page | 33
Figure 9: Enrollment Portal (Step 2)

Page | 34
Figure 10: Enrollment Portal (Step 3) 1.1

Page | 35
Figure 11: Enrollment Portal (Step 3) 1.2

Page | 36
Figure 12: Enrollment Portal (Step 4)

Page | 37
Figure 13: Student Pre-Enrollment Database Manager 1.1

Page | 38
Figure 14: Student Pre-Enrollment Database Manager 1.2

Page | 39
Figure 15: Student Pre-Enrollment Database Manager 1.3

Page | 40
Figure 16: Student Pre-Enrollment Database Manager 1.4

Page | 41
Figure 17: Student Pre-Enrollment Database Manager 1.5

Page | 42
Figure 18: Student Pre-Enrollment Database Manager 1.6

Page | 43
Figure 19: Student Pre-Enrollment Database Manager 1.7

Page | 44
Figure 20: Teacher Information Database Manager 1.1

Page | 45
Figure 21: Teacher Information Database Manager 1.2

Page | 46
Figure 22: Login History Database Manager 1.1

Page | 47
Figure 23: Login History Database Manager 1.2

Page | 48
Figure 24: Login History Database Manager 1.3

Page | 49
Figure 25: Login History Database Manager 1.4

Page | 50
Figure 26: About Me

Page | 51
Figure 27: User Information

Page | 52
Figure 28: Change Information

Page | 53
Figure 29: Change Password

Page | 54
Figure 30: Capture ID Picture 1.1

Page | 55
Figure 31: Capture ID Picture 1.2

Page | 56
Figure 32: Capture ID Picture 1.3

Page | 57
Chapter 5 – Conclusion and Recommendations

This chapter presents the study's findings, which are grouped into two groups. The first
is the System Statistics, which we use to review and analyze the data we collect to identify where
we can make improvements and adapt. The second research we believe needs to be improved is
the statistics based on the performance on the day of the presentation.

Summary of findings, Conclusions and Recommendations


This presents the summary, the major findings, conclusions and recommendations of the
study on “Pre-Enrollment Management System for Young Achievers’ School of Caloocan Inc.
SY. 2021-2022”. From the findings, conclusions were drawn, and recommendation were
presented. The researchers used frequency, percentage, and mean to determine the data gathered
from the survey questionnaires the respondents will also be used to summarize the gathered
data.

SUMMARY OF FINDINGS
1. What programming language did the programmer use to develop this program? And
why?
➢ VB.NET, because its more user-friendly and efficient for everyone who wants to use
it, we concentrated our program on security, user-friendliness for everyone who
wants to use it, and inefficiency for the admins so that they don't spend a lot of time
and effort. They can readily access the records and data of such students by using
our application. This is the application that is essential for us to be successful in our
program.
2. What color scheme is used by the programmer? And why?
➢ We are inspired to use the color of our beloved school Young Achievers’ School of
Caloocan Inc. We use the light blue color so that is the sign that this program is
specially for Young Achievers’ School of Caloocan.
3. In terms of layout and design, does the system pass? And why?
➢ According to Question 1 “Layout and Design”, With a mean rating of 5.1, the layout
and design are outstanding. This indicates that respondents are quite satisfied, and it
has become an essential part of the system. We make our own layout and designs.
We use applications like PicsArt for editing and some photoshops.
4. Is it simple to use the system? And why?
➢ Basing on Section 1 Table 2 The Ease of Use is remarkable, with a mean rating of
5.17. This shows that respondents find the system to be very easy to use, and it has
become an important component of the system. Basing on the section 2 table 10 With
an average rating of 88.33 percent, this is the most popular question, showing that
the respondents are quite impressed with the presenters' understanding of their
program. We make sure that our program is easy to use and you will clearly
understand the functions that we input.

Page | 58
5. Is it a user-friendly system? And why?
➢ Basing on Section 1 Table 3 With a mean rating of 5.27, user friendliness is
exceptional. This indicates that respondents consider the system to be very user-
friendly and understandable, and that it has become an important part of the system.
We make sure our program is understandable. We put the help button so the users
will know how to use easily our program.
6. Is the security of the system competent? And why?
➢ Basing on section 1 table 4 Security rates exceptionally well, with a mean rating of
5.07. This shows that respondents believe the system is very secure, and the degree
of access is very rational, and that it has become a critical component of the system.
Our program has a forgot password feature which you will need to put your
username, full name, date of birth, and the place of birth so it can’t be access easily
and also if you change your password you will need to put the old password so if you
input the wrong password your password will not change.
7. In terms of reliability, is the system accepted? And why?
➢ Basing on Section 1 Table 5 With a mean rating of 5.17, reliability scores remarkably
well. This demonstrates that respondents believe the system has no downtime or
DEBUG, is extremely reliable, and has become an essential component of the
system. Our system is 100% sure that the functions is working. We accept those
comments or suggestions to improve the reliability of our program.
8. Is the system dependable and trustworthy? And why?
➢ Basing on Section 1 Table 6 Dependability ranks quite well, with a mean rating of
5.07. This shows that respondents believe the system is very dependable, and that it
has become an important part of the system. Our system is trustworthy because only
the admin can access that important information of the students so there’s no leak of
information will happen.
9. Is the system unique and creative? And why?
➢ Basing on Section 1 Table 7 With a mean rating of 5.27, creativity and originality do
pretty well. This demonstrates that respondents believe the creative and unique are
key parts of the system. We created our program with our own design ideas. Those
Database, Home page, Log In form etc. Is designed by our System designer also
those buttons. We imagine and this is the output of our imagination which lead to
the very unique program. We make sure that our system is unique and you can’t find
similarity in the internet

Page | 59
CONCLUSION
From the findings, the following conclusions were drawn:
The study reveals the system's strengths and flaws, as well as how it may be improved
and adapted to create a competent and reliable enrollment system. Our Pre-Enrollment
Management System allows school administrators to simply see and mark the students who have
enrolled. It also features a Students Information Database where you can look up information
about the students. They are able to easily enroll students. The fact that all of the respondents
were from the Young Achievers School of Caloocan Inc. is one of the study's flaws since the
study is limited. Students in the field of information and communication technology, as well as
teachers and administrators in schools, the goal of the study was to work on improving the
enrolling system in a unique way and effective way.

RECOMMENDATIONS
Based on the findings and conclusions of the study, the following recommendations were drawn:

1. We advise future researchers to have a clear flow of your program because it will be
difficult to alter if there is a "slight" change, and it may break if you make a change.
2. We propose using our system for extra objectives including as attendance, library
monitoring, and so on because of its scalability. For our school, it is important to create
a centralized system that includes a variety of competent data management systems in
order to improve school control and improve the quality of all of the teachers, registrars,
and students.
3. We recommend that only school personnel must use the program, and no students should
have access to the school's confidential data.
4. Because it has an advanced login with a level of access rational on the user's authority,
we upgrade a system with a level of security that is appropriate to a typical system's
utilization. Always pay attention to the level of detail of your system when you're
working on it when you're developing it. Because even if the system's practicality is
critical, if the user doesn't comprehend the program because of its irrational design, its
meaning is negated.

Page | 60
References

Rowley (2005), Computerized Enrollment System | PDF | Software Testing | Software


https://www.scribd.com/document/434758397/Computerized-Enrollment-System

Dunn and Scott (2005), Enrollment portal This is where aspiring applicants fill out
their information
https://www.coursehero.com/file/p67fqbln/Enrollment-portal-This-is-where-aspiring-
applicants-fill-out-their-information/

Sybex Inc (1999),


https://www.academia.edu/7761467/Chapter1_2_100711202027_phpapp02

Gold Chager et al. (2003), Inventory System


https://newyorkessays.com/essay-review-of-related-literature-about-inventory-system/

Mane (2000), Campus Research Thesis and Dissertation Data Banking System
https://blablawriting.net/campus-research-thesis-and-dissertation-data-banking-system-
essay

Gurewich (1999), Database Driven Web Systems for Education.


https://eric.ed.gov/?id=EJ589928

Dioso (2011), Computerized Enrollment System for Mary Lourdes Academy


https://www.academia.edu/12481820/Computerized_Enrollment_System_for_Mary_L
ourdes_Academy

Ralph M. Stair (2009), Computerized Enrollment


https://www.scribd.com/doc/298506224/Computerized-Enrollment

Ilagan (2010), Enrollment system in Far Eastern University-Institute of Technology


https://www.coursehero.com/file/19474732/Thesis-1/

Veritas Parochial School (VPS), Online class scheduling system


https://www.academia.edu/34447178/Online_class_scheduling_system

Page | 61
Appendices

APPENDIX A
Letter to the Teacher
April 4, 2021
Dear Respondent,

Mabuhay YASC!
We are students at Young Achievers School of Caloocan. As one of our requirements in
Immersion subject, we are going to conduct a study entitled “Pre-Enrollment Management
System for Young Achievers’ School of Caloocan Inc.” The objective of the project is: (1) To
develop a pre-enrollment system for all aspiring students at Young Achievers’ School of
Caloocan, (2) To automate the Pre-enrollment process and student’s reference number
generation,

In this regard, we would like to request your permission that we are allowed to conduct the study
in your class (ICT 2).

Your approval would certainly contribute to the success of this research project.

We sincerely pray and hope for your kind and consideration and favorable response.

Respectfully yours

Adrian Badong
Allen Manalo
Jhon Keneth Namias
John Benedict Legaspi
John Carl Meru
Jun Mark Palahang
Kaye Tuazon
Shereen Jeouel Balod
Student Researchers

Noted by:

Mr. Ranilio David


Capstone Project Adviser; and

Mr. Chrysler Indigo Panaguiton


Capstone Project Consultant

Page | 62
APPENDIX B
Letter to the Respondents
April 4, 2021
Dear Respondent,

Mabuhay YASC!
We are students at Young Achievers School of Caloocan. As one of our requirements in
Immersion subject, we are going to conduct a study entitled “Pre-Enrollment Management
System for Young Achievers’ School of Caloocan Inc.” The objective of the project is: (1) To
develop a pre-enrollment system for all aspiring students at Young Achievers’ School of
Caloocan, (2) To automate the Pre-enrollment process and student’s reference number
generation,

In this regard, we (Group 1) would like to request your participation in the said study. We assure
you that your responses shall only be used for the study and that they shall be kept confidential.

We sincerely pray and hope for your kind and consideration and favorable response.

Respectfully yours

Adrian Badong
Allen Manalo
Jhon Keneth Namias
John Benedict Legaspi
John Carl Meru
Jun Mark Palahang
Kaye Tuazon
Shereen Jeouel Balod
Student Researchers

Noted by:

Mr. Ranilio David


Capstone Project Adviser; and

Mr. Chrysler Indigo Panaguiton


Capstone Project Consultant

Page | 63
APPENDIX C
Documentations

Figure 1: The section 1 of the survey form and letter to respondents in Grade 12 Information
and Communication Technologies Students are shown in this image.

Page | 64
Figure 2: The section 2 of the survey form and letter to respondents in Grade 12 Information
and Communication Technologies Students are shown in this image.

Page | 65
Jhon Keneth Namias – Programming

Figure 3: The main programmer and project leader next to the program he makes
“Pre-Enrollment Management System for Young Achievers’ School of Caloocan Inc.”
are shown in this image.

Page | 66
Jhon Keneth Namias – Presenting the system on Grade 11 ICT students

Jhon Keneth Namias - Assigning members for the research paper

Jhon Keneth Namias - Working on the design of the program

Page | 67
Jhon Keneth Namias – Making Flowchart, System Diagram, and Organizational Chart

Shereen Balod – Helping with Namias on Chapter 2 of the Research Paper

Page | 68
Kaye Tuazon - Organization chart

Kaye Tuazon - Gantt chart

Page | 69
Jun mark Palahang – Contributing on the research paper

Page | 70
Page | 71
Page | 72
Page | 73
Page | 74
Page | 75
Page | 76
Page | 77
Page | 78
Questionnaire

Pre-Enrollment Management System for


Young Achievers’ School of Caloocan Inc.
Questionnaire
Section 1 - System Features
Instructions: The questions below are used to grade system features in order to determine
where they should be improved and developed.
Please mark your response with the following questions
Questions 1 - Very poor 2 - Poor 3 - Average 4 - Above Average 5 - Satisfactory 6 - Highest

Layout and Design


(Text, Fonts are easy to read
and clear, Colors are matching
No space wasted)
Ease of Use
(Functions of the system are
easy to use)
User friendliness
(End-User can easily
understand the system or
program)
Security
(Authentication and level of
access)
Reliability
(No downtime, and No
DEBUG)
Dependability
Creativity and Originality
(Buttons, Icons, Images used
in the program are original)
Section 2 - How the presenter presented the system
Instructions: The questions below are used to grade how the presenter presented the system
Please mark your response with the following questions
Questions 1 - Very poor 2 - Poor 3 - Average 4 - Above Average 5 - Satisfactory 6 - Highest

Do you understand the


presentation?
Are you satisfied with the
program or project presented?
Are the presenters well
knowledgeable about their
program?
Are your questions/thoughts
were answered?

Page | 79
Pre-Enrollment Management System for
Young Achievers’ School of Caloocan Inc.
Sample Answered Questionnaire
Section 1 - System Features
Instructions: The questions below are used to grade system features in order to determine
where they should be improved and developed.
Please mark your response with the following questions
Questions 1 - Very poor 2 - Poor 3 - Average 4 - Above Average 5 - Satisfactory 6 - Highest

Layout and Design Check


(Text, Fonts are easy to read
and clear, Colors are matching
No space wasted)
Ease of Use Check
(Functions of the system are
easy to use)
User friendliness Check
(End-User can easily
understand the system or
program)
Security Check
(Authentication and level of
access)
Reliability Check
(No downtime, and No
DEBUG)
Dependability Check
Creativity and Originality Check
(Buttons, Icons, Images used
in the program are original)
Section 2 - How the presenter presented the system
Instructions: The questions below are used to grade how the presenter presented the system
Please mark your response with the following questions
Questions 1 - Very poor 2 - Poor 3 - Average 4 - Above Average 5 - Satisfactory 6 - Highest

Do you understand the Check


presentation?
Are you satisfied with the Check
program or project presented?
Are the presenters well Check
knowledgeable about their
program?
Are your questions/thoughts Check
were answered?

Page | 80
Flowchart

Simplified System Flowchart

Figure 1: Most of the system's features are not depicted in this simplified flowchart.

Page | 81
Login flowchart

Figure 2: Login access is provided for the following users: Admin, Teacher, and Guest, with
the exception of Guest, who cannot enter login information.

Users may access the 'Login Guide' by clicking the help button, which will instruct them on
the process and step-by-step procedures for logging in.

When a user successfully entered into the system, the following information was recorded on
the log: Date of login, Level of access, Time in, Time out, and Remarks.

It was also possible to go to 'Forgot password' and input the user's data to retrieve their own
password with security, and all they needed to do was enter the following: User ID, Name,
Date of Birth, and Place of Birth.

Page | 82
Enrollment Process (Step 1)

Page | 83
Figure 3: Enrollment Process (Step 1) Main step for gathering students’ data. The old student
can only be access by user who has admin access.

Page | 84
Source Code

GitHub link: https://github.com/PP-Namias/Pre-enrollment-Management-System

VB.Net file Lines of Code Page


AboutMe.vb 13 85
CapturePicture.vb 190 86-89
ChangeInfo.vb 453 90-98
ChangePassword.vb 371 99-106
EnrollmentData.vb 1891 107-142
ForgotPassword.vb 233 143-147
GenarateID.vb 608 148-161
LoginForm.vb 692 162-175
LoginGuide.vb 17 176
LoginHistory.vb 630 177-188
LoginHistoryGuide.vb 19 189
MainForm.vb 1075 190-209
PrintID.vb 22 210
StudentEnrollment.vb 2082 211-251
StudentEnrollmentGuide.vb 15 252
StudentRegistered.vb 55 253-254
StudentRequirements.vb 180 255-258
StudentSubject.vb 779 259-273
TeacherData.vb 757 274-288
TeacherDataGuide.vb 15 289
UserInfo.vb 115 290-292
Total lines of code: 10212 207

AboutMe.vb
Public Class AboutMe

Private Sub LinkLabel1_LinkClicked(sender As Object, e As


LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked

Process.Start("https://github.com/PP-Namias")

End Sub

Private Sub AboutMe_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

End Class

Page | 85
CapturePicture.vb
Imports AForge.Video
Imports AForge.Video.DirectShow

Public Class CapturePicture

Dim gbCamera As VideoCaptureDevice


Dim bmp As Bitmap

Private Sub RoundButtonStartCamera(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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(btnStartCamera.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()

btnStartCamera.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonCapture(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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 RoundButtonSavePicture(btn As Button)

btn.FlatStyle = FlatStyle.Flat

Page | 86
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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(btnSavePicture.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()

btnSavePicture.Region = New Region(Raduis)

End Sub

Private Sub Captures(sender As Object, eventArgs As NewFrameEventArgs)

bmp = DirectCast(eventArgs.Frame.Clone(), Bitmap)


PictureBox1.Image = DirectCast(eventArgs.Frame.Clone(), Bitmap)

End Sub

Private Sub CapturePicture_FormClosing(sender As Object, e As FormClosingEventArgs)


Handles Me.FormClosing

Try

If TeacherData.cmbCapture.Text = "TeacherInfo" Then

TeacherData.cmbCapture.Text = ""

ElseIf StudentEnrollment.cmbEnrollment.Text = "Enrollment" Then

StudentEnrollment.cmbEnrollment.Text = ""

ElseIf EnrollmentData.cmbCapture.Text = "EnrollmentData" Then

EnrollmentData.cmbCapture.Text = ""

ElseIf ChangeInfo.cmbCapture.Text = "ChangeInfo" Then

ChangeInfo.cmbCapture.Text = ""

End If

If gbCamera Is Nothing Then

'do nothing

Else

gbCamera.Stop()

End If

Page | 87
Catch ex As Exception

MsgBox(ex.Message(), MsgBoxStyle.Critical, "Camera error")


Exit Sub

End Try

End Sub

Private Sub BtnStartCamera_Click(sender As Object, e As EventArgs) Handles


btnStartCamera.Click

Try

Dim camera As New VideoCaptureDeviceForm

If camera.ShowDialog() = Windows.Forms.DialogResult.OK Then

gbCamera = camera.VideoDevice
AddHandler gbCamera.NewFrame, New NewFrameEventHandler(AddressOf
Captures)
gbCamera.Start()

End If

Catch ex As Exception

MsgBox(ex.Message(), MsgBoxStyle.Critical, "Camera error")


Exit Sub

End Try

End Sub

Private Sub BtnCapture_Click(sender As Object, e As EventArgs) Handles


btnCapture.Click

PictureBox2.Image = PictureBox1.Image

If TeacherData.cmbCapture.Text = "TeacherData" Then

TeacherData.PictureID.Image = PictureBox1.Image

ElseIf EnrollmentData.cmbCapture.Text = "EnrollmentData" Then

EnrollmentData.PictureID.Image = PictureBox1.Image

ElseIf StudentEnrollment.cmbEnrollment.Text = "Enrollment" Then

StudentEnrollment.StudentPic.Image = PictureBox1.Image

ElseIf ChangeInfo.cmbCapture.Text = "ChangeInfo" Then

ChangeInfo.IDPicture.Image = PictureBox1.Image

End If

Page | 88
End Sub

Private Sub BtnSavePicture_Click(sender As Object, e As EventArgs) Handles


btnSavePicture.Click

SaveFileDialog1.DefaultExt = ".jpg"

If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then

PictureBox2.Image.Save(SaveFileDialog1.FileName, Imaging.ImageFormat.Jpeg)

End If

End Sub

Private Sub CapturePicture_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

RoundButtonStartCamera(btnStartCamera)
RoundButtonCapture(btnCapture)
RoundButtonSavePicture(btnSavePicture)

End Sub

End Class

Page | 89
ChangeInfo.vb
Imports System.Data.OleDb
Imports System.IO

Public Class ChangeInfo

Private Sub RoundButtonUpdate(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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(btnUpdate.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()

btnUpdate.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonClear(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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(btnClear.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()

btnClear.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonClose(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

Page | 90
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(btnClose.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()

btnClose.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonCapture(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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

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)

Page | 91
End Sub

Private Sub RoundButtonRemove(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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 BtnCancel_Click(sender As Object, e As EventArgs) Handles


btnClose.Click

MainForm.Dispose()

Dim User As New MainForm


Hide()
User.Show()

End Sub

Private Sub ChangeInfo_FormClosing(sender As Object, e As FormClosingEventArgs)


Handles Me.FormClosing

MainForm.Dispose()

Dim User As New MainForm


Hide()
User.Show()

End Sub

Private Function RequiredEntry() As Boolean

If txtUserName.Text = "" Or txtPOB.Text = "" Or txtEmailID.Text = "" Then

MsgBox("Please enter all information....", MsgBoxStyle.Critical,


"Attention")

Return True

Exit Function

End If

Page | 92
End Function

Private Sub ChangeInfo_Load(sender As Object, e As EventArgs) Handles MyBase.Load

RoundButtonUpdate(btnUpdate)
RoundButtonClear(btnClear)
RoundButtonClose(btnClose)
RoundButtonCapture(btnCapture)
RoundButtonBrowse(btnBrowse)
RoundButtonRemove(btnRemove)

Try
Dim LoadConnection As New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

Dim LoadDataReader As OleDbDataReader


Dim LoadCommand As New OleDbCommand

If LoginForm.cmbFormState.Text = "Teacher" Then

If LoadConnection.State = ConnectionState.Open Then


LoadConnection.Close()
LoadConnection.Open()

LoadCommand.CommandText = "select
[TeacherID],[Username],[DateOfBirth],[PlaceOfBirth],[EmailID],[TeacherPic] from
TeacherInfo where TeacherID = '" & LoginForm.txtTeacherUsername.Text & "'"
LoadCommand.Connection = LoadConnection

LoadDataReader = LoadCommand.ExecuteReader

If LoadDataReader.Read Then

txtUserName.Text = LoadDataReader(1).ToString()
dtpDOB.Text = LoadDataReader(2).ToString()
txtPOB.Text = LoadDataReader(3).ToString()
txtEmailID.Text = LCase(LoadDataReader(4)).ToString()

Dim bytTeacher As Byte() = LoadDataReader("TeacherPic")


Dim msTeacher As New MemoryStream(bytTeacher)
IDPicture.Image = Image.FromStream(msTeacher)

End If

LoadConnection.Close()

Return

End If

If LoginForm.cmbFormState.Text = "Admin" Then

If LoadConnection.State = ConnectionState.Open Then


LoadConnection.Close()
LoadConnection.Open()

Page | 93
LoadCommand.CommandText = "select
[AdminID],[Username],[DateOfBirth],[PlaceOfBirth],[EmailID],[AdminPic] from AdminInfo
where AdminID = '" & LoginForm.txtAdminUsername.Text & "'"
LoadCommand.Connection = LoadConnection

LoadDataReader = LoadCommand.ExecuteReader

If LoadDataReader.Read Then

txtUserName.Text = LoadDataReader(1).ToString()
dtpDOB.Text = LoadDataReader(2).ToString()
txtPOB.Text = LoadDataReader(3).ToString()
txtEmailID.Text = LCase(LoadDataReader(4)).ToString()

Dim bytAdmin As Byte() = LoadDataReader("AdminPic")


Dim msAdmin As New MemoryStream(bytAdmin)
IDPicture.Image = Image.FromStream(msAdmin)

End If

LoadConnection.Close()

Return

End If

Catch ex As Exception

MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error")


Exit Try

End Try

End Sub

Private Sub BtnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click

txtUserName.Clear()
dtpDOB.Value = Today
txtPOB.Clear()
txtEmailID.Clear()
IDPicture.Image = Image.FromFile(My.Application.Info.DirectoryPath &
"\Image\personal.PNG")

End Sub

Private Sub BtnUpdate_Click(sender As Object, e As EventArgs) Handles


btnUpdate.Click

If RequiredEntry() = True Then Return

Try

Dim UpdateConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

Page | 94
'Teacher Data Update
If LoginForm.cmbFormState.Text = "Teacher" Then

If UpdateConnection.State = ConnectionState.Open Then


UpdateConnection.Close()
UpdateConnection.Open()

Dim TeacherCommand As New OleDbCommand("Update TeacherInfo Set


Username=@UName,DateOfBirth=@DOB,PlaceOfBirth=@POB,EmailID=@EmailID,TeacherPic=@Pic
Where (TeacherID='" & LoginForm.txtTeacherUsername.Text & "')", UpdateConnection)

' User name


Dim UserName As New OleDbParameter("@UName", OleDbType.VarWChar, 100)
With {
.Value = txtUserName.Text.ToString()
}
TeacherCommand.Parameters.Add(UserName)

'Date of Birth
Dim DOB As New OleDbParameter("@DOB", OleDbType.Date, 25) With {
.Value = dtpDOB.Text.ToString()
}
TeacherCommand.Parameters.Add(DOB)

'Place of Birth
Dim POB As New OleDbParameter("@POB", OleDbType.VarWChar, 100) With {
.Value = txtPOB.Text.ToString()
}
TeacherCommand.Parameters.Add(POB)

'Email ID
Dim EmailID As New OleDbParameter("@EmailID", OleDbType.VarWChar, 100)
With {
.Value = txtEmailID.Text.ToString()
}
TeacherCommand.Parameters.Add(EmailID)

Dim TeacherMemStream As New MemoryStream


Dim TeacherDataPic_Update As Byte()

IDPicture.Image.Save(TeacherMemStream, Imaging.ImageFormat.Png)
TeacherDataPic_Update = TeacherMemStream.GetBuffer()
TeacherMemStream.Read(TeacherDataPic_Update, 0,
TeacherMemStream.Length)

' Teacher ID Picture


Dim TeacherPicture As New OleDbParameter("@Pic", SqlDbType.Image) With
{
.Value = TeacherDataPic_Update
}
TeacherCommand.Parameters.Add(TeacherPicture)

If TeacherCommand.ExecuteNonQuery() Then

UpdateConnection.Close()

Page | 95
MsgBox("Your data updated successfully.", MsgBoxStyle.Information,
"Data Updated")
MainForm.Dispose()
Close()

Else

MsgBox("Your data update failed.", MsgBoxStyle.Critical, "Update


Failed")
Return

End If

End If

'Admin Data Update


If LoginForm.cmbFormState.Text = "Admin" Then

If UpdateConnection.State = ConnectionState.Open Then


UpdateConnection.Close()
UpdateConnection.Open()

Dim AdminCommand As New OleDbCommand("Update AdminInfo Set


Username=@UserName,DateOfBirth=@DOB,PlaceOfBirth=@POB,EmailID=@EmailID,AdminPic=@Pic
Where (AdminID='" & LoginForm.txtAdminUsername.Text & "') ", UpdateConnection)

' Admin name


Dim AdminName As New OleDbParameter("@AdminName", OleDbType.VarWChar,
100) With {
.Value = txtUserName.Text.ToString()
}
AdminCommand.Parameters.Add(AdminName)

' Date of Birth


Dim DOB As New OleDbParameter("@DOB", OleDbType.Date, 100) With {
.Value = dtpDOB.Text.ToString()
}
AdminCommand.Parameters.Add(DOB)

' Place of Birth


Dim POB As New OleDbParameter("@POB", OleDbType.VarWChar, 100) With {
.Value = txtPOB.Text.ToString()
}
AdminCommand.Parameters.Add(POB)

' Email ID
Dim EmailID As New OleDbParameter("@EmailID", OleDbType.VarWChar, 100)
With {
.Value = txtEmailID.Text.ToString()
}
AdminCommand.Parameters.Add(EmailID)

Dim AdminMemStream As New MemoryStream


Dim AdminDataPic_Update As Byte()

IDPicture.Image.Save(AdminMemStream, Imaging.ImageFormat.Png)
AdminDataPic_Update = AdminMemStream.GetBuffer()

Page | 96
AdminMemStream.Read(AdminDataPic_Update, 0, AdminMemStream.Length)

' Admin ID Picture


Dim AdminPicture As New OleDbParameter("@Pic", SqlDbType.Image) With {
.Value = AdminDataPic_Update
}
AdminCommand.Parameters.Add(AdminPicture)

If AdminCommand.ExecuteNonQuery() Then

UpdateConnection.Close()

MsgBox("Your data updated successfully.", MsgBoxStyle.Information,


"Data Updated")

MainForm.Dispose()

Close()

Else

MsgBox("Your data update failed.", MsgBoxStyle.Critical, "Update


Failed")
Return

End If

End If

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

IDPicture.Image = Image.FromFile(My.Application.Info.DirectoryPath &


"\Image\personal.PNG")

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:"

Page | 97
.Filter = "Image files:
(*.jpg)|*.jpg|(*.jpeg)|*.jpeg|(*.png)|*.png|(*.Gif)|*.Gif|(*.bmp)|*.bmp| All Files
(*.*)|*.*"

If .ShowDialog = Windows.Forms.DialogResult.OK Then

IDPicture.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 BtnCapture_Click(sender As Object, e As EventArgs) Handles


btnCapture.Click

cmbCapture.Text = "ChangeInfo"
CapturePicture.Show()

End Sub

End Class

Page | 98
ChangePassword.vb
Imports System.Data.OleDb
Imports System.Text

Public Class ChangePassword

Private Sub RoundButtonUpdate(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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(btnUpdate.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()

btnUpdate.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonClear(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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(btnClear.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()

btnClear.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonClose(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

Page | 99
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(btnClose.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()

btnClose.Region = New Region(Raduis)

End Sub

'Encryption
Public Function Encrypt(Encryption As String) As String

Dim encode As Byte() = New Byte(Encryption.Length - 1) {}


encode = Encoding.UTF8.GetBytes(Encryption)
Dim msg As String = Convert.ToBase64String(encode)
Return msg

End Function

Private Function RequiredEntry() As Boolean

If txtOldPass.Text = "" Or TxtNewPass.Text = "" Or txtConformPass.Text = ""


Then

MsgBox("Please enter all information....", MsgBoxStyle.Critical,


"Attention...")

txtOldPass.Focus()

Return True

Exit Function

End If

End Function

Private Sub CmdClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click

txtOldPass.Clear()
TxtNewPass.Clear()
txtConformPass.Clear()
txtOldPass.Focus()

End Sub

Private Sub CmdEdit_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click

If RequiredEntry() = True Then Return

Try

Page | 100
Dim okcancel As Integer = MessageBox.Show("Do you really want to update
this record?", "Change Password", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

If okcancel = vbCancel Then

Return

Else

Dim SelectConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

Dim SelectDataReader As OleDbDataReader


Dim SelectCommand As New OleDbCommand

If LoginForm.cmbFormState.Text = "Teacher" Then

If SelectConnection.State = ConnectionState.Open Then


SelectConnection.Close()
SelectConnection.Open()

SelectCommand.CommandText = "SELECT [TeacherID],[Password] FROM


TeacherInfo WHERE TeacherID = '" & LoginForm.txtTeacherUsername.Text & "'"
SelectCommand.Connection = SelectConnection
SelectDataReader = SelectCommand.ExecuteReader

If SelectDataReader.Read Then

If SelectDataReader("Password") = Encrypt(txtOldPass.Text) Then

If TxtNewPass.Text = txtConformPass.Text Then

Try

Dim UpdateConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

' Teacher Data Update


If UpdateConnection.State = ConnectionState.Open
Then UpdateConnection.Close()
UpdateConnection.Open()

Dim TeacherCommand As New OleDbCommand("Update


TeacherInfo Set [Password]=@Password Where (TeacherID='" &
SelectDataReader("TeacherID") & "')", UpdateConnection)

' Password
Dim Password As New OleDbParameter("@Password",
OleDbType.VarWChar, 200) With {
.Value = Encrypt(TxtNewPass.Text).ToString
}
TeacherCommand.Parameters.Add(Password)

If TeacherCommand.ExecuteNonQuery() Then

Page | 101
UpdateConnection.Close()

MsgBox("Your password update successfully...",


MsgBoxStyle.Information, "Password Updated")

btnClear.PerformClick()

MainForm.Dispose()

Close()

Else

MsgBox("Password updation failed ",


MsgBoxStyle.Critical, "Updation Failed")
Return

End If

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Password
'UPDATE' error")
Exit Sub

End Try

Else

MessageBox.Show("Password & conform password does not


match", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning)

End If

Else

MsgBox("Old password is Wrong!!!", MsgBoxStyle.Critical,


"Password Wrong")

End If

End If

Return

End If

If LoginForm.cmbFormState.Text = "Admin" Then

If SelectConnection.State = ConnectionState.Open Then


SelectConnection.Close()
SelectConnection.Open()

SelectCommand.CommandText = "SELECT [AdminID],[Password] FROM


AdminInfo WHERE AdminID = '" & LoginForm.txtAdminUsername.Text & "'"
SelectCommand.Connection = SelectConnection
SelectDataReader = SelectCommand.ExecuteReader

Page | 102
If SelectDataReader.Read Then

If SelectDataReader("Password") = Encrypt(txtOldPass.Text) Then

If TxtNewPass.Text = txtConformPass.Text Then

Try

Dim UpdateConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

' Admin Data Update


If UpdateConnection.State = ConnectionState.Open
Then UpdateConnection.Close()
UpdateConnection.Open()

Dim TeacherCommand As New OleDbCommand("Update


AdminInfo Set [Password]=@Password Where (AdminID ='" & SelectDataReader("AdminID")
& "')", UpdateConnection)

' Password
Dim Password As New OleDbParameter("@Password",
OleDbType.VarWChar, 200) With {
.Value = Encrypt(TxtNewPass.Text).ToString
}
TeacherCommand.Parameters.Add(Password)

If TeacherCommand.ExecuteNonQuery() Then

UpdateConnection.Close()

MsgBox("Your password update successfully...",


MsgBoxStyle.Information, "Password Updated")

btnClear.PerformClick()

MainForm.Dispose()

Close()

Else

MsgBox("Password updation failed ",


MsgBoxStyle.Critical, "Updation Failed")
Return

End If

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Password
'UPDATE' error")
Exit Sub

End Try

Page | 103
Else

MessageBox.Show("Password & Conform password does not


match", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning)

End If

Else

MsgBox("Old password is Wrong!!!", MsgBoxStyle.Critical,


"Password Wrong")
Return

End If

End If

Return

End If

End If

Catch ex As Exception

MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error Changing Password")


Exit Sub

End Try

End Sub

Private Sub ChangePassword_FormClosing(sender As Object, e As FormClosingEventArgs)


Handles Me.FormClosing

MainForm.Dispose()

Dim User As New MainForm


Hide()
User.Show()

End Sub

Private Sub CmdCancel_Click(sender As Object, e As EventArgs) Handles


btnClose.Click

Close()

End Sub

Private Sub TxtNewPass_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


TxtNewPass.KeyPress

Dim NotAllowed As String = "~`@%^&+={[}]()!:,;'><?/|\-.#+"

'Allowed letters numbers and ( _ $ *)

If e.KeyChar <> ControlChars.Back = True Then

Page | 104
If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtOldPass_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


txtOldPass.KeyPress

Dim NotAllowed As String = "~`@%^&+={[}]()!:,;'><?/|\-.#+"

'Allowed letters numbers and ( _ $ *)

If e.KeyChar <> ControlChars.Back = True Then

If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtConformPass_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtConformPass.KeyPress

Dim NotAllowed As String = "~`@%^&+={[}]()!:,;'><?/|\-.#+"

'Allowed letters numbers and ( _ $ *)

If e.KeyChar <> ControlChars.Back = True Then

If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub ChangePassword_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

btnClear.PerformClick()

txtOldPass.Focus()

RoundButtonUpdate(btnUpdate)
RoundButtonClear(btnClear)

Page | 105
RoundButtonClose(btnClose)

End Sub

End Class

Page | 106
EnrollmentData.vb
Imports System.Data.OleDb
Imports System.IO
Public Class EnrollmentData

Private Sub RoundButtonApprove(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(btnApprove.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()

btnApprove.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonDenied(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(btnDenied.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()

btnDenied.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonSave(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 12)

Page | 107
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(btnSave.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()

btnSave.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonDelete(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(btnDelete.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()

btnDelete.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)

Page | 108
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 RoundButtonGenerateID(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

Page | 109
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(btnGenerateID.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()

btnGenerateID.Region = New Region(Raduis)

End Sub

Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load

RoundButtonApprove(btnApprove)
RoundButtonDenied(btnDenied)
RoundButtonSave(btnSave)
RoundButtonDelete(btnDelete)
RoundButtonCapture(btnCapture)
RoundButtonBrowse(btnBrowse)
RoundButtonRemove(btnRemove)
RoundButtonGenerateID(btnGenerateID)

'TODO: This line of code loads data into the


'Pre_enrollmentDataSet.EnrollmentData' table. You can move, or remove it, as needed.
Me.EnrollmentDataTableAdapter.Fill(Me.Pre_enrollmentDataSet.EnrollmentData)

Try

Dim x As Byte() = AdvancedDataGridView1.CurrentRow.Cells(0).Value


Dim ms As New MemoryStream(x)
PictureID.Image = Image.FromStream(ms)

Dim Status As String = AdvancedDataGridView1.CurrentRow.Cells(3).Value


StatusTextBox.Text = Status

If StatusTextBox.Text = "enrolled" Then

btnApprove.Visible = False
btnGenerateID.Visible = True

Else

btnApprove.Visible = True
btnGenerateID.Visible = False

End If

If StatusTextBox.Text = "denied" Then

btnDenied.Visible = False

Else

btnDenied.Visible = True

Page | 110
End If

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Load Picture ID failed!")


Exit Sub

End Try

End Sub

Private Sub AdvancedDataGridView1_SortStringChanged(sender As Object, e As


EventArgs) Handles AdvancedDataGridView1.SortStringChanged

EnrollmentDataBindingSource.Sort = AdvancedDataGridView1.SortString

End Sub

Private Sub AdvancedDataGridView1_FilterStringChanged(sender As Object, e As


EventArgs) Handles AdvancedDataGridView1.FilterStringChanged

EnrollmentDataBindingSource.Filter = AdvancedDataGridView1.FilterString

End Sub

Private Sub EnrollmentDataBindingSource_ListChanged(sender As Object, e As


System.ComponentModel.ListChangedEventArgs) Handles
EnrollmentDataBindingSource.ListChanged

lblTotal.Text = String.Format("Total Student Pre-enrolled: {0}",


EnrollmentDataBindingSource.List.Count)

End Sub

Sub SaveData()

Try

Dim SaveDataConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If SaveDataConnection.State = ConnectionState.Open Then


SaveDataConnection.Close()
SaveDataConnection.Open()

Dim SaveDataCommand As New OleDbCommand("Update EnrollmentData Set


[StudentNumber]=@StudentNumber,[GradeLevel]=@GradeLevel,[Strand]=@Strand,[Semester]=@Se
mester,[SchoolYear]=@SchoolYear,[Lastname]=@Lastname,[Firstname]=@Firstname,[Middlename
]=@Middlename,[Age]=@Age,DOB=@DOB,[Sex]=@Sex,[POB]=@POB,[Nationality]=@Nationality,[Rel
igion]=@Religion,[Email]=@Email,[MobileNumber]=@MobileNumber,[TelephoneNumber]=@Telepho
neNumber,[Address]=@Address,[City]=@City,[FatherName]=@FatherName,[FatherOccupation]=@F
atherOccupation,[FatherEmail]=@FatherEmail,[FatherWorkAddress]=@FatherWorkAddress,[Fath
erContactNumber]=@FatherContactNumber,[MotherName]=@MotherName,[MotherOccupation]=@Moth
erOccupation,[MotherEmail]=@MotherEmail,[MotherWorkAddress]=@MotherWorkAddress,[MotherC
ontactNumber]=@MotherContactNumber,[NumberOfSiblings]=@NumberOfSiblings,[PersonEmergenc
y]=@PersonEmergency,[GuardianName]=@GuardianName,[GuardianRelation]=@GuardianRelation,[
GuardianEmail]=@GuardianEmail,[GuardianWorkAddress]=@GuardianWorkAddress,[GuardianConta

Page | 111
ctNumber]=@GuardianContactNumber,[FetcherName]=@FetcherName,[FetcherContactNumber]=@Fet
cherContactNumber,[SiblingsOfStudent1]=@SiblingsOfStudent1,[SiblingsOfStudent2]=@Siblin
gsOfStudent2,[SiblingsOfStudent3]=@SiblingsOfStudent3,[SiblingsOfStudentAge1]=@Siblings
OfStudentAge1,[SiblingsOfStudentAge2]=@SiblingsOfStudentAge2,[SiblingsOfStudentAge3]=@S
iblingsOfStudentAge3,[SiblingsOfStudentSchool1]=@SiblingsOfStudentSchool1,[SiblingsOfSt
udentSchool2]=@SiblingsOfStudentSchool2,[SiblingsOfStudentSchool3]=@SiblingsOfStudentSc
hool3,[SchoolLastAttended1]=@SchoolLastAttended1,[SchoolLastAttended2]=@SchoolLastAtten
ded2,[SchoolLastAttended3]=@SchoolLastAttended3,[AcademicYear1]=@AcademicYear1,[Academi
cYear2]=@AcademicYear2,[AcademicYear3]=@AcademicYear3,[ReasonApplying]=@ReasonApplying,
[Status]=@Status,StudentPicture=@StudentPicture Where (EnrollmentNumber=" &
EnrollmentNumberTextBox1.Text & ")", SaveDataConnection)

' Student Number


Dim StudentNumber As New OleDbParameter("@StudentNumber",
OleDbType.VarWChar, 100) With {
.Value = StudentNumberTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(StudentNumber)

' Grade Level


Dim GradeLevel As New OleDbParameter("@GradeLevel", OleDbType.VarWChar,
100) With {
.Value = GradeLevelTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(GradeLevel)

' Strand
Dim Strand As New OleDbParameter("@Strand", OleDbType.VarWChar, 100) With {
.Value = StrandTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Strand)

' Semester
Dim Semester As New OleDbParameter("@Semester", OleDbType.VarWChar, 100)
With {
.Value = SemesterTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Semester)

' SchoolYear
Dim SchoolYear As New OleDbParameter("@SchoolYear", OleDbType.VarWChar,
100) With {
.Value = SchoolYearTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SchoolYear)

' Lastname
Dim Lastname As New OleDbParameter("@Lastname", OleDbType.VarWChar, 100)
With {
.Value = LastnameTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Lastname)

' Firstname
Dim Firstname As New OleDbParameter("@Firstname", OleDbType.VarWChar, 100)
With {
.Value = FirstnameTextBox1.Text.ToString()
}

Page | 112
SaveDataCommand.Parameters.Add(Firstname)

' Middlename
Dim Middlename As New OleDbParameter("@Middlename", OleDbType.VarWChar,
100) With {
.Value = MiddlenameTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Middlename)

' Age
Dim Age As New OleDbParameter("@Age", OleDbType.VarWChar, 100) With {
.Value = AgeTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Age)

' Date of Birth


Dim DOB As New OleDbParameter("@DOB", OleDbType.Date, 100) With {
.Value = DOBDateTimePicker1.Text.ToString()
}
SaveDataCommand.Parameters.Add(DOB)

' Sex
Dim Sex As New OleDbParameter("@Sex", OleDbType.VarWChar, 100) With {
.Value = SexTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Sex)

' Place of Birth


Dim POB As New OleDbParameter("@POB", OleDbType.VarWChar, 100) With {
.Value = POBTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(POB)

' Nationality
Dim Nationality As New OleDbParameter("@Nationality", OleDbType.VarWChar,
100) With {
.Value = NationalityTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Nationality)

' Religion
Dim Religion As New OleDbParameter("@Religion", OleDbType.VarWChar, 100)
With {
.Value = ReligionTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Religion)

' Email
Dim Email As New OleDbParameter("@Email", OleDbType.VarWChar, 100) With {
.Value = EmailTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Email)

' Mobile Number


Dim MobileNumber As New OleDbParameter("@MobileNumber", OleDbType.VarWChar,
100) With {
.Value = MobileNumberTextBox1.Text.ToString()
}

Page | 113
SaveDataCommand.Parameters.Add(MobileNumber)

' TelephoneNumber
Dim TelephoneNumber As New OleDbParameter("@TelephoneNumber",
OleDbType.VarWChar, 100) With {
.Value = TelephoneNumberTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(TelephoneNumber)

' Address
Dim Address As New OleDbParameter("@Address", OleDbType.VarWChar, 100) With
{
.Value = AddressTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(Address)

' City
Dim City As New OleDbParameter("@City", OleDbType.VarWChar, 100) With {
.Value = CityTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(City)

' Father Name


Dim FatherName As New OleDbParameter("@FatherName", OleDbType.VarWChar,
100) With {
.Value = FatherNameTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FatherName)

' Father Occupation


Dim FatherOccupation As New OleDbParameter("@FatherOccupation",
OleDbType.VarWChar, 100) With {
.Value = FatherOccupationTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FatherOccupation)

' Father Email


Dim FatherEmail As New OleDbParameter("@FatherEmail", OleDbType.VarWChar,
100) With {
.Value = FatherEmailTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FatherEmail)

' Father Work Address


Dim FatherWorkAddress As New OleDbParameter("@FatherWorkAddress",
OleDbType.VarWChar, 100) With {
.Value = FatherWorkAddressTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FatherWorkAddress)

' Father Contact Number


Dim FatherContactNumber As New OleDbParameter("@FatherContactNumber",
OleDbType.VarWChar, 100) With {
.Value = FatherContactNumberTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FatherContactNumber)

' Mother Name

Page | 114
Dim MotherName As New OleDbParameter("@MotherName", OleDbType.VarWChar,
100) With {
.Value = MotherNameTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(MotherName)

' Mother Occupation


Dim MotherOccupation As New OleDbParameter("@MotherOccupation",
OleDbType.VarWChar, 100) With {
.Value = MotherOccupationTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(MotherOccupation)

' Mother Email


Dim MotherEmail As New OleDbParameter("@MotherEmail", OleDbType.VarWChar,
100) With {
.Value = MotherEmailTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(MotherEmail)

' Mother Work Address


Dim MotherWorkAddress As New OleDbParameter("@MotherWorkAddress",
OleDbType.VarWChar, 100) With {
.Value = MotherWorkAddressTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(MotherWorkAddress)

' Mother Contact Number


Dim MotherContactNumber As New OleDbParameter("@MotherContactNumber",
OleDbType.VarWChar, 100) With {
.Value = MotherContactNumberTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(MotherContactNumber)

' Number of Siblings


Dim NumberOfSiblings As New OleDbParameter("@NumberOfSiblings",
OleDbType.VarWChar, 100) With {
.Value = NumberOfSiblingsTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(NumberOfSiblings)

' Person in case of Emergency


Dim PersonEmergency As New OleDbParameter("@PersonEmergency",
OleDbType.VarWChar, 100) With {
.Value = PersonEmergencyTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(PersonEmergency)

' Guardian Name


Dim GuardianName As New OleDbParameter("@GuardianName", OleDbType.VarWChar,
100) With {
.Value = GuardianNameTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(GuardianName)

' Guardian Relation


Dim GuardianRelation As New OleDbParameter("@GuardianRelation",
OleDbType.VarWChar, 100) With {

Page | 115
.Value = GuardianRelationTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(GuardianRelation)

' Guardian Email


Dim GuardianEmail As New OleDbParameter("@GuardianEmail",
OleDbType.VarWChar, 100) With {
.Value = GuardianEmailTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(GuardianEmail)

' Guardian Work Address


Dim GuardianWorkAddress As New OleDbParameter("@GuardianWorkAddress",
OleDbType.VarWChar, 100) With {
.Value = GuardianWorkAddressTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(GuardianWorkAddress)

' Guardian Contact Number


Dim GuardianContactNumber As New OleDbParameter("@GuardianContactNumber",
OleDbType.VarWChar, 100) With {
.Value = GuardianContactNumberTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(GuardianContactNumber)

' Fetcher Name


Dim FetcherName As New OleDbParameter("@FetcherName", OleDbType.VarWChar,
100) With {
.Value = FetcherNameTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FetcherName)

' Fetcher Contact Number


Dim FetcherContactNumber As New OleDbParameter("@FetcherContactNumber",
OleDbType.VarWChar, 100) With {
.Value = FetcherContactNumberTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(FetcherContactNumber)

' Siblings of Student 1


Dim SiblingsOfStudent1 As New OleDbParameter("@SiblingsOfStudent1",
OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudent1TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudent1)

' Siblings of Student 2


Dim SiblingsOfStudent2 As New OleDbParameter("@SiblingsOfStudent2",
OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudent2TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudent2)

' Siblings of Student 3


Dim SiblingsOfStudent3 As New OleDbParameter("@SiblingsOfStudent3",
OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudent3TextBox1.Text.ToString()
}

Page | 116
SaveDataCommand.Parameters.Add(SiblingsOfStudent3)

' Siblings of Student Age 1


Dim SiblingsOfStudentAge1 As New OleDbParameter("@SiblingsOfStudentAge1",
OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudentAge1TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudentAge1)

' Siblings of Student Age 2


Dim SiblingsOfStudentAge2 As New OleDbParameter("@SiblingsOfStudentAge2",
OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudentAge2TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudentAge2)

' Siblings of Student Age 3


Dim SiblingsOfStudentAge3 As New OleDbParameter("@SiblingsOfStudentAge3",
OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudentAge3TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudentAge3)

' Siblings of Student School 1


Dim SiblingsOfStudentSchool1 As New
OleDbParameter("@SiblingsOfStudentSchool1", OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudentSchool1TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudentSchool1)

' Siblings of Student School 2


Dim SiblingsOfStudentSchool2 As New
OleDbParameter("@SiblingsOfStudentSchool2", OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudentSchool2TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudentSchool2)

' Siblings of Student School 3


Dim SiblingsOfStudentSchool3 As New
OleDbParameter("@SiblingsOfStudentSchool3", OleDbType.VarWChar, 100) With {
.Value = SiblingsOfStudentSchool3TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SiblingsOfStudentSchool3)

' School Last Attended 1


Dim SchoolLastAttended1 As New OleDbParameter("@SchoolLastAttended1",
OleDbType.VarWChar, 100) With {
.Value = SchoolLastAttended1TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SchoolLastAttended1)

' School Last Attended 2


Dim SchoolLastAttended2 As New OleDbParameter("@SchoolLastAttended2",
OleDbType.VarWChar, 100) With {
.Value = SchoolLastAttended2TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SchoolLastAttended2)

Page | 117
' School Last Attended 3
Dim SchoolLastAttended3 As New OleDbParameter("@SchoolLastAttended3",
OleDbType.VarWChar, 100) With {
.Value = SchoolLastAttended3TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(SchoolLastAttended3)

' Academic Year 1


Dim AcademicYear1 As New OleDbParameter("@AcademicYear1",
OleDbType.VarWChar, 100) With {
.Value = AcademicYear1TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(AcademicYear1)

' AcademicYear2
Dim AcademicYear2 As New OleDbParameter("@AcademicYear2",
OleDbType.VarWChar, 100) With {
.Value = AcademicYear2TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(AcademicYear2)

' AcademicYear3
Dim AcademicYear3 As New OleDbParameter("@AcademicYear3",
OleDbType.VarWChar, 100) With {
.Value = AcademicYear3TextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(AcademicYear3)

' Reason Applying


Dim ReasonApplying As New OleDbParameter("@ReasonApplying",
OleDbType.VarWChar, 550) With {
.Value = ReasonApplyingTextBox1.Text.ToString()
}
SaveDataCommand.Parameters.Add(ReasonApplying)

' Status
Dim Status As New OleDbParameter("@Status", OleDbType.VarWChar, 100) With {
.Value = StatusTextBox.Text.ToString()
}
SaveDataCommand.Parameters.Add(Status)

Dim StudentMemStream As New MemoryStream


Dim StudentDataPic_Update As Byte()

PictureID.Image.Save(StudentMemStream, Imaging.ImageFormat.Png)
StudentDataPic_Update = StudentMemStream.GetBuffer()
StudentMemStream.Read(StudentDataPic_Update, 0, StudentMemStream.Length)

' Student ID Picture


Dim TeacherPicture As New OleDbParameter("@StudentPicture",
SqlDbType.Image) With {
.Value = StudentDataPic_Update
}
SaveDataCommand.Parameters.Add(TeacherPicture)

If SaveDataCommand.ExecuteNonQuery() Then

SaveDataConnection.Close()

Page | 118
MsgBox("Your data updated successfully.", MsgBoxStyle.Information,
"Data Updated")

Else

MsgBox("Your data update failed.", MsgBoxStyle.Critical, "Update


Failed")
Return

End If

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Saving data failed!")


Exit Sub

End Try

End Sub

Private Sub BtnApprove_Click(sender As Object, e As EventArgs) Handles


btnApprove.Click

Try

Dim EnrollmentApproveConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If EnrollmentApproveConnection.State = ConnectionState.Open Then


EnrollmentApproveConnection.Close()
EnrollmentApproveConnection.Open()

Dim EnrollmentApproveCommand As New OleDbCommand("Update EnrollmentData Set


Status=@Status,StudentNumber=@StudentNumber Where EnrollmentNumber=" &
AdvancedDataGridView1.CurrentRow.Cells(2).Value & "", EnrollmentApproveConnection)

' Status
Dim Status As New OleDbParameter("@Status", OleDbType.VarChar, 100) With {
.Value = "enrolled"
}
EnrollmentApproveCommand.Parameters.Add(Status)

Dim year As String =


AdvancedDataGridView1.CurrentRow.Cells(12).Value.ToString()
Dim SplitPart = year.Split(" "c)
Dim Sfinal As String = SplitPart(0).Trim
Dim years As String = (String.Format("{0}", Sfinal)).ToString
Dim SplitParts = years.Split("0"c)
Dim finals As String = SplitParts(1).Trim
Dim yearss As String = (String.Format("{0}", Sfinal)).ToString

' Student Number


Dim StudentNumber As New OleDbParameter("@StudentNumber",
OleDbType.VarChar, 100) With {
.Value = (yearss.Remove(0, 2)).ToString & "-" &
(String.Format("{0:000000}", AdvancedDataGridView1.CurrentRow.Cells(2).Value)).ToString
}

Page | 119
EnrollmentApproveCommand.Parameters.Add(StudentNumber)

If EnrollmentApproveCommand.ExecuteNonQuery() Then

EnrollmentApproveConnection.Close()
MsgBox("Student approved successfully.", MsgBoxStyle.Information,
"Student Approved!")

Me.EnrollmentDataTableAdapter.Fill(Me.Pre_enrollmentDataSet.EnrollmentData)

Else

MsgBox("Your data update failed.", MsgBoxStyle.Critical, "Update


Failed")
Return

End If

If StatusTextBox.Text = "enrolled" Then

btnApprove.Visible = False
btnGenerateID.Visible = True

Else

btnApprove.Visible = True
btnGenerateID.Visible = False

End If

If StatusTextBox.Text = "denied" Then

btnDenied.Visible = False

Else

btnDenied.Visible = True

End If

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Saving data failed!")


Exit Sub

End Try

End Sub

Private Sub BtnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click

SaveData()

Me.EnrollmentDataTableAdapter.Fill(Me.Pre_enrollmentDataSet.EnrollmentData)

End Sub

Page | 120
Private Sub BtnDelete_Click(sender As Object, e As EventArgs) Handles
btnDelete.Click

Try

If AdvancedDataGridView1.CurrentRow.Cells(2).Value.ToString <> "" Then

If MsgBox("Are you sure to delete data of the student: " &


AdvancedDataGridView1.CurrentRow.Cells(6).Value.ToString & ", " &
AdvancedDataGridView1.CurrentRow.Cells(7).Value.ToString & " " &
AdvancedDataGridView1.CurrentRow.Cells(8).Value.ToString & "?", MsgBoxStyle.OkCancel,
"Delete confirm") = MsgBoxResult.Cancel Then

' do nothing

Else

Dim EnrollmentDeleteConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If EnrollmentDeleteConnection.State = ConnectionState.Open Then


EnrollmentDeleteConnection.Close()
EnrollmentDeleteConnection.Open()

Dim temp As Integer = 0


Dim query As String = "DELETE FROM EnrollmentData Where
EnrollmentNumber=" & AdvancedDataGridView1.CurrentRow.Cells(2).Value & ""

Dim EnrollmentDeleteCommand As New OleDbCommand(query) With {


.Connection = EnrollmentDeleteConnection
}

temp = EnrollmentDeleteCommand.ExecuteNonQuery()
If temp > 0 Then

EnrollmentDeleteConnection.Close()

MessageBox.Show("Student enrollment data successfully deleted",


"Successfully deleted!", MessageBoxButtons.OK, MessageBoxIcon.Information)

Me.EnrollmentDataTableAdapter.Fill(Me.Pre_enrollmentDataSet.EnrollmentData)

Else

MessageBox.Show("No record found", "Sorry",


MessageBoxButtons.OK, MessageBoxIcon.Error)

End If

End If

Else

MsgBox("Can't 'delete' students data. Make sure to have proper


enrollment number!", MsgBoxStyle.OkOnly, "Students Data")

Page | 121
End If

Catch ex As Exception

MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error 'DELETE' students data")


Exit Sub

End Try

End Sub

Private Sub BtnCapture_Click(sender As Object, e As EventArgs) Handles


btnCapture.Click

cmbCapture.Text = "EnrollmentData"
CapturePicture.Show()

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

PictureID.Image = Image.FromFile(.FileName)

End If

End With

Catch ex As Exception

MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error...")

End Try

End Sub

Private Sub BtnRemove_Click(sender As Object, e As EventArgs) Handles


btnRemove.Click

PictureID.Image = Image.FromFile(My.Application.Info.DirectoryPath &


"\Image\personal.png")

End Sub

Page | 122
Private Sub AdvancedDataGridView1_CellClick(sender As Object, e As
DataGridViewCellEventArgs) Handles AdvancedDataGridView1.CellClick

Try

Dim x As Byte() = AdvancedDataGridView1.CurrentRow.Cells(0).Value


Dim ms As New MemoryStream(x)
PictureID.Image = Image.FromStream(ms)

Dim Status As String = AdvancedDataGridView1.CurrentRow.Cells(3).Value


StatusTextBox.Text = Status

If StatusTextBox.Text = "enrolled" Then

btnApprove.Visible = False
btnGenerateID.Visible = True

Else

btnApprove.Visible = True
btnGenerateID.Visible = False

End If

If StatusTextBox.Text = "denied" Then

btnDenied.Visible = False

Else

btnDenied.Visible = True

End If

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Load Picture ID failed!")


Exit Sub

End Try

End Sub

Private Sub AdvancedDataGridView1_CellContentClick(sender As Object, e As


DataGridViewCellEventArgs) Handles AdvancedDataGridView1.CellContentClick

If AdvancedDataGridView1.Columns(e.ColumnIndex).Name = "Approve" Then

btnApprove.PerformClick()

End If

End Sub

Private Sub BtnDenied_Click(sender As Object, e As EventArgs) Handles


btnDenied.Click

Try

Page | 123
Dim EnrollmentDeniedConnection As New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If EnrollmentDeniedConnection.State = ConnectionState.Open Then


EnrollmentDeniedConnection.Close()
EnrollmentDeniedConnection.Open()

Dim EnrollmentDeniedCommand As New OleDbCommand("Update EnrollmentData Set


Status=@Status,StudentNumber=@StudentNumber Where EnrollmentNumber=" &
AdvancedDataGridView1.CurrentRow.Cells(2).Value & "", EnrollmentDeniedConnection)

' Status
Dim Status As New OleDbParameter("@Status", OleDbType.VarChar, 100) With {
.Value = "denied"
}
EnrollmentDeniedCommand.Parameters.Add(Status)

' Student Number


Dim StudentNumber As New OleDbParameter("@StudentNumber",
OleDbType.VarChar, 100) With {
.Value = ""
}
EnrollmentDeniedCommand.Parameters.Add(StudentNumber)

If EnrollmentDeniedCommand.ExecuteNonQuery() Then

EnrollmentDeniedConnection.Close()

MsgBox("Student denied successfully.", MsgBoxStyle.Information,


"Student Denied!")

Me.EnrollmentDataTableAdapter.Fill(Me.Pre_enrollmentDataSet.EnrollmentData)

Else

MsgBox("Your data update failed.", MsgBoxStyle.Critical, "Update


Failed")
Return

End If

If StatusTextBox.Text = "enrolled" Then

btnApprove.Visible = False
btnGenerateID.Visible = True

Else

btnApprove.Visible = True
btnGenerateID.Visible = False

End If

If StatusTextBox.Text = "denied" Then

Page | 124
btnDenied.Visible = False

Else

btnDenied.Visible = True

End If

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Rejecting data failed!")


Exit Sub

End Try

End Sub

Private Sub GenerateID_Click(sender As Object, e As EventArgs) Handles


btnGenerateID.Click

cmbStudentNum.Text = AdvancedDataGridView1.CurrentRow.Cells(4).Value.ToString

GenarateID.Show()

End Sub

Private Sub EnrollmentNumberTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles EnrollmentNumberTextBox1.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub StudentNumberTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles StudentNumberTextBox1.KeyPress

'Allowed Numbers and "-" only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 45 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Page | 125
Private Sub GradeLevelTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)
Handles GradeLevelTextBox1.KeyPress

'Allowed Numbers and "-" only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 45 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub StrandTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles StrandTextBox1.KeyPress

'Allowed letters numbers and ()


If e.KeyChar <> ControlChars.Back = True Then

If "~`@%^&+={[}]!:,;'><?/|\-.#+_$*".IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub SemesterTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles SemesterTextBox1.KeyPress

'Allowed Letters and Number only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = ".~`@#$%^&*()_-+={[}]:;',!><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub SchoolYearTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles SchoolYearTextBox1.KeyPress

'Allowed Numbers and "-" only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 45 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

Page | 126
End If

End If

End Sub

Private Sub LastnameTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles LastnameTextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub FirstnameTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles FirstnameTextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub MiddlenameTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles MiddlenameTextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Page | 127
Private Sub AgeTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles
AgeTextBox1.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub DOBDateTimePicker1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles DOBDateTimePicker1.KeyPress

'Allowed all

End Sub

Private Sub SexTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


SexTextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub EmailTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles EmailTextBox1.KeyPress

'Allowed letters numbers and ( @ _ . )


If e.KeyChar <> ControlChars.Back = True Then

If "~`%^&+={[}]()!:,;'>$<?/|\-*#+".IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub MobileNumberTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles MobileNumberTextBox1.KeyPress

Page | 128
'Allowed Numbers only
If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub TelephoneNumberTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles TelephoneNumberTextBox1.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub POBTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


POBTextBox1.KeyPress

'Allowed Letters, Number and "." only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "~`@#$%^&*()_-+={[}]:;',!><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub NationalityTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles NationalityTextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

Page | 129
End If

End If

End Sub

Private Sub ReligionTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles ReligionTextBox1.KeyPress

'Allowed Letters and ( / \ ) only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?|"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub AddressTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles AddressTextBox1.KeyPress

'Allowed Letters, Number and "." only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "~`@#$%^&*()_-+={[}]:;',!><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub CityTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


CityTextBox1.KeyPress

'Allowed Letters, Number and "." only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "~`@#$%^&*()_-+={[}]:;',!><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Page | 130
Private Sub FatherNameTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)
Handles FatherNameTextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub FatherOccupationTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles FatherOccupationTextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub FatherEmailTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles FatherEmailTextBox1.KeyPress

'Allowed letters numbers and ( _ @ )


If e.KeyChar <> ControlChars.Back = True Then

If "~`%^&+$*={[}]()!:,;'><?/|\-.#+".IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub FatherWorkAddressTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles FatherWorkAddressTextBox1.KeyPress

'Allowed Letters, Number and "." only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "~`@#$%^&*()_-+={[}]:;',!><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

Page | 131
e.Handled = True

End If

End If

End Sub

Private Sub FatherContactNumberTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles FatherContactNumberTextBox1.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub MotherNameTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles MotherNameTextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub MotherOccupationTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles MotherOccupationTextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Page | 132
Private Sub MotherEmailTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)
Handles MotherEmailTextBox1.KeyPress

'Allowed letters numbers and ( _ @ )


If e.KeyChar <> ControlChars.Back = True Then

If "~`%^&+$*={[}]()!:,;'><?/|\-.#+".IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub MotherWorkAddressTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles MotherWorkAddressTextBox1.KeyPress

'Allowed Letters, Number and "." only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "~`@#$%^&*()_-+={[}]:;',!><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub MotherContactNumberTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles MotherContactNumberTextBox1.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub PersonEmergencyTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles PersonEmergencyTextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

Page | 133
e.Handled = True

End If

End If

End Sub

Private Sub GuardianNameTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles GuardianNameTextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub GuardianRelationTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles GuardianRelationTextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub GuardianEmailTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles GuardianEmailTextBox1.KeyPress

'Allowed letters numbers and ( _ @ )


If e.KeyChar <> ControlChars.Back = True Then

If "~`%^&+$*={[}]()!:,;'><?/|\-.#+".IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Page | 134
Private Sub GuardianWorkAddressTextBox1_KeyPress(sender As Object, e As
KeyPressEventArgs) Handles GuardianWorkAddressTextBox1.KeyPress

'Allowed Letters, Number and "." only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "~`@#$%^&*()_-+={[}]:;',!><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub GuardianContactNumberTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles GuardianContactNumberTextBox1.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub FetcherNameTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles FetcherNameTextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub FetcherContactNumberTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles FetcherContactNumberTextBox1.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

Page | 135
e.Handled = True

End If

End If

End Sub

Private Sub NumberOfSiblingsTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles NumberOfSiblingsTextBox1.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub SiblingsOfStudent1TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles SiblingsOfStudent1TextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub SiblingsOfStudent2TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles SiblingsOfStudent2TextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

Page | 136
End Sub

Private Sub SiblingsOfStudent3TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles SiblingsOfStudent3TextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub SiblingsOfStudentAge1TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles SiblingsOfStudentAge1TextBox1.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub SiblingsOfStudentAge2TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles SiblingsOfStudentAge2TextBox1.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub SiblingsOfStudentAge3TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles SiblingsOfStudentAge3TextBox1.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

Page | 137
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub SiblingsOfStudentSchool1TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles SiblingsOfStudentSchool1TextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub SiblingsOfStudentSchool2TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles SiblingsOfStudentSchool2TextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub SiblingsOfStudentSchool3TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles SiblingsOfStudentSchool3TextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

Page | 138
End If

End Sub

Private Sub SchoolLastAttended1TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles SchoolLastAttended1TextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub SchoolLastAttended2TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles SchoolLastAttended2TextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub SchoolLastAttended3TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles SchoolLastAttended3TextBox1.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub AcademicYear1TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles AcademicYear1TextBox1.KeyPress

Page | 139
'Allowed Numbers and "-" only
If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 45 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub AcademicYear2TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles AcademicYear2TextBox1.KeyPress

'Allowed Numbers and "-" only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 45 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub AcademicYear3TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles AcademicYear3TextBox1.KeyPress

'Allowed Numbers and "-" only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 45 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub ReasonApplyingTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles ReasonApplyingTextBox1.KeyPress

'Allowed Letters, Number and "." only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "~`@#$%^&*()_-+={[}]:;',!><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

Page | 140
End If

End Sub

Private Sub StatusTextBox_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles StatusTextBox.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub IdentifierDateTimePicker_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles IdentifierDateTimePicker.KeyPress

'Allowed all

End Sub

Private Sub ConditionTextBox_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles ConditionTextBox.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub Requirement1TextBox_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles Requirement1TextBox.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

Page | 141
End Sub

Private Sub Requirement2TextBox_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles Requirement2TextBox.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub Requirement3TextBox_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles Requirement3TextBox.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub Requirement4TextBox_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles Requirement4TextBox.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

End Class

Page | 142
ForgotPassword.vb
Imports System.Data.OleDb
Imports System.Text

Public Class ForgotPassword

Private Sub RoundButtonCheck(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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 RoundButtonClear(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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(btnClear.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()

btnClear.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonClose(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

Page | 143
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(btnClose.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()

btnClose.Region = New Region(Raduis)

End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles btnClose.Click

Close()

End Sub

Private Sub FrmForgetPass_FormClosing(sender As Object, e As FormClosingEventArgs)


Handles Me.FormClosing

Dispose()

LoginForm.Show()

End Sub

Private Sub LinkLabel2_LinkClicked(sender As Object, e As


LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked

Dispose()

LoginForm.Show()

End Sub
Sub Clear()

txtUserName.Clear()
dtpDOB.Value = Today
txtPOB.Clear()
txtUserID.Clear()

End Sub
Private Function RequiredEntry() As Boolean

If txtUserName.Text = "" Or txtPOB.Text = "" Or txtUserID.Text = "" Then

MsgBox("Please enter all information", MsgBoxStyle.Critical, "Attention")

Return True

Exit Function

Page | 144
End If

End Function

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnCheck.Click

If RequiredEntry() = True Then Return

Try

If LoginForm.cmbFormState.Text = "Teacher" Then

Dim TeacherConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If TeacherConnection.State = ConnectionState.Open Then


TeacherConnection.Close()
TeacherConnection.Open()

Dim TeacherDataReader As OleDbDataReader


Dim TeacherCommand As New OleDbCommand With {
.CommandText = "select
[TeacherID],[Username],[DateOfBirth],[PlaceOfBirth],[Password] from TeacherInfo where
TeacherID = '" & txtUserID.Text & "'",
.Connection = TeacherConnection
}

If TeacherConnection.State = ConnectionState.Closed Then


TeacherConnection.Open()
TeacherDataReader = TeacherCommand.ExecuteReader

If TeacherDataReader.Read Then

If UCase(TeacherDataReader(1)) = UCase(txtUserName.Text) And


UCase(TeacherDataReader(2)) = UCase(dtpDOB.Text) And UCase(TeacherDataReader(3)) =
UCase(txtPOB.Text) Then

MessageBox.Show("Your password is .:{ '" &


Decrypt(TeacherDataReader(4).ToString()) & "' ]:. ", "Info", MessageBoxButtons.OK,
MessageBoxIcon.Information)
LinkLabel2.Visible = True
TeacherConnection.Close()

Else

MessageBox.Show("Incorect input", "Error",


MessageBoxButtons.OK, MessageBoxIcon.Error)
TeacherConnection.Close()

End If

Else

MessageBox.Show("UserID is wrong", "Error", MessageBoxButtons.OK,


MessageBoxIcon.Error)
TeacherConnection.Close()

Page | 145
End If

End If

If LoginForm.cmbFormState.Text = "Admin" Then

Dim AdminConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

Dim AdminDataReader As OleDbDataReader


Dim AdminCommand As New OleDbCommand

If AdminConnection.State = ConnectionState.Open Then


AdminConnection.Close()
AdminConnection.Open()

AdminCommand.CommandText = "select
[AdminID],[Username],[DateOfBirth],[PlaceOfBirth],[Password] from AdminInfo where
AdminID = '" & txtUserID.Text & "'"
AdminCommand.Connection = AdminConnection
AdminDataReader = AdminCommand.ExecuteReader

If AdminDataReader.Read Then

If UCase(AdminDataReader("Username")) = UCase(txtUserName.Text) And


UCase(AdminDataReader("DateOfBirth")) = UCase(dtpDOB.Text) And
UCase(AdminDataReader("PlaceOfBirth")) = UCase(txtPOB.Text) Then

MessageBox.Show("Your password is .:{ '" &


Decrypt(AdminDataReader(4).ToString()) & "' }:. ", "Info", MessageBoxButtons.OK,
MessageBoxIcon.Information)
LinkLabel2.Visible = True
AdminConnection.Close()

Else

MessageBox.Show("Incorect input!!! ", "Error",


MessageBoxButtons.OK, MessageBoxIcon.Error)
AdminConnection.Close()

End If

Else

MessageBox.Show("UserID is wrong!!! ", "Error",


MessageBoxButtons.OK, MessageBoxIcon.Error)
AdminConnection.Close()

End If

End If

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Data Error")


Exit Sub

Page | 146
End Try

End Sub

'Decryption
Public Function Decrypt(Decryption As String) As String

Dim encodedtext As New UTF8Encoding


Dim decode As Decoder = encodedtext.GetDecoder
Dim code_byte As Byte() = Convert.FromBase64String(Decryption)
Dim charcount As Integer = decode.GetCharCount(code_byte, 0, code_byte.Length)
Dim decode_char As Char() = New Char(charcount - 1) {}
decode.GetChars(code_byte, 0, code_byte.Length, decode_char, 0)
Dim decryptext As New String(decode_char)
Return decryptext

End Function

Private Sub FrmForgetPass_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

RoundButtonCheck(btnCheck)
RoundButtonClear(btnClear)
RoundButtonClose(btnClose)

dtpDOB.Value = Today

End Sub

End Class

Page | 147
GenarateID.vb
Imports System.Data.OleDb
Imports System.IO

Public Class GenarateID

Sub FillDataID()
Try
Dim FillDataIDConnection As New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" &
My.Application.Info.DirectoryPath.ToString() & "\BackUp\Database.Accdb;Persist Security
Info=False;")
If FillDataIDConnection.State = ConnectionState.Open Then
FillDataIDConnection.Close()
FillDataIDConnection.Open()

Dim FillDataIDDataReader As OleDbDataReader

Dim FillDataIDCommand As New OleDbCommand("SELECT


[StudentPicture],[StudentNumber],[Firstname],[Middlename],[Lastname],[GradeLevel],[Stra
nd],[PersonEmergency],[GuardianName],[GuardianContactNumber],[Address],[City] FROM
EnrollmentData WHERE EnrollmentNumber = 6", FillDataIDConnection)

FillDataIDDataReader = FillDataIDCommand.ExecuteReader

If FillDataIDDataReader.Read Then
Dim x As Byte() = FillDataIDDataReader(0)
Dim ms As New MemoryStream(x)
PicID.Image = Image.FromStream(ms)

Dim strGrade As String


If UCase(FillDataIDDataReader(5)).ToString() = "NURSERY - PRE-SCHOOL"
Then
strGrade = "Nursery"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(5)).ToString() = "KINDER 1 - PRE-


SCHOOL" Then
strGrade = "Kinder 1"

Page | 148
StudentNumber.Text = "'" &
UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(5)).ToString() = "KINDER 2 - PRE-


SCHOOL" Then
strGrade = "Kinder 2"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(5)).ToString() = "GRADE 1 -


ELEMENTARY" Then
strGrade = "Grade 1"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

Page | 149
FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(5)).ToString() = "GRADE 2 -


ELEMENTARY" Then
strGrade = "Grade 2"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(5)).ToString() = "GRADE 3 -


ELEMENTARY" Then
strGrade = "Grade 3"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(5)).ToString() = "GRADE 4 -


ELEMENTARY" Then
strGrade = "Grade 4"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()

Page | 150
GradeID.Text = "Grade: " & strGrade
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(5)).ToString() = "GRADE 5 -


ELEMENTARY" Then
strGrade = "Grade 5"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(5)).ToString() = "GRADE 6 -


ELEMENTARY" Then
strGrade = "Grade 6"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

Page | 151
ElseIf UCase(FillDataIDDataReader(5)).ToString() = "GRADE 7 - JUNIOR
HIGH SCHOOL" Then
strGrade = "Grade 7"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(5)).ToString() = "GRADE 8 - JUNIOR


HIGH SCHOOL" Then
strGrade = "Grade 8"
StudentNumber.Text = "'" &
UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(5)).ToString() = "GRADE 9 - JUNIOR


HIGH SCHOOL" Then
strGrade = "Grade 9"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(10)).ToString()

Page | 152
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(5)).ToString() = "GRADE 10 - JUNIOR


HIGH SCHOOL" Then
strGrade = "Grade 10"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(5)).ToString() = "GRADE 11 - SENIOR


HIGH SCHOOL" Then
strGrade = "Grade 11"

Dim strStrand As String


If UCase(FillDataIDDataReader(6)).ToString() = "ACADEMIC -
ACCOUNTANCY, BUSINESS AND MANAGEMENT (ABM)" Then
strStrand = "ABM"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

Page | 153
ElseIf UCase(FillDataIDDataReader(6)).ToString() = "ACADEMIC -
GENERAL ACADEMIC STRAND (GAS)" Then
strStrand = "GAS"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(6)).ToString() = "ACADEMIC -


HUMANITIES AND SOCIAL SCIENCES (HUMSS)" Then
strStrand = "HUMSS"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(6)).ToString() = "ACADEMIC -


SCIENCE, TECHNOLOGY, ENGINEERING AND MATHEMATICS (STEM)" Then
strStrand = "STEM"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand

Page | 154
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(6)).ToString() = "TVL - HOME


ECONOMICS (HE)" Then
strStrand = "HE"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(6)).ToString() = "TVL -


INFORMATION AND COMMUNICATIONS TECHNOLOGY (ICT)" Then
strStrand = "ICT"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

Page | 155
FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(6)).ToString() = "TVL TRACKS -


INDUSTRIAL ARTS (IA)" Then
strStrand = "IA"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return
Else
strStrand = ""

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

End If

ElseIf UCase(FillDataIDDataReader(5)).ToString() = "GRADE 12 - SENIOR


HIGH SCHOOL" Then
strGrade = "Grade 12"

Dim strStrand As String

Page | 156
If UCase(FillDataIDDataReader(6)).ToString() = "ACADEMIC -
ACCOUNTANCY, BUSINESS AND MANAGEMENT (ABM)" Then
strStrand = "ABM"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(6)).ToString() = "ACADEMIC -


GENERAL ACADEMIC STRAND (GAS)" Then
strStrand = "GAS"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(6)).ToString() = "ACADEMIC -


HUMANITIES AND SOCIAL SCIENCES (HUMSS)" Then
strStrand = "HUMSS"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand

Page | 157
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(6)).ToString() = "ACADEMIC -


SCIENCE, TECHNOLOGY, ENGINEERING AND MATHEMATICS (STEM)" Then
strStrand = "STEM"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(6)).ToString() = "TVL - HOME


ECONOMICS (HE)" Then
strStrand = "HE"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

Page | 158
FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(6)).ToString() = "TVL -


INFORMATION AND COMMUNICATIONS TECHNOLOGY (ICT)" Then
strStrand = "ICT"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " &
UCase(FillDataIDDataReader(13)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(7)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(9)).ToString()
Address.Text = UCase(FillDataIDDataReader(10)).ToString()
City.Text = UCase(FillDataIDDataReader(11)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

ElseIf UCase(FillDataIDDataReader(6)).ToString() = "TVL TRACKS -


INDUSTRIAL ARTS (IA)" Then
strStrand = "IA"

StudentNumber.Text = "'" &


UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
LRN.Text = "LRN: 136812090393" '&
UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(8)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(9)).ToString()
FetcherContact.Text =
UCase(FillDataIDDataReader(10)).ToString()
Address.Text = UCase(FillDataIDDataReader(11)).ToString()
City.Text = UCase(FillDataIDDataReader(12)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

Else
strStrand = ""

Page | 159
StudentNumber.Text = "'" &
UCase(FillDataIDDataReader(1)).ToString() & "'"
NameID.Text = UCase(FillDataIDDataReader(2)).ToString() & " " &
UCase(FillDataIDDataReader(3)).ToString().Substring(0, 1) & ". " &
UCase(FillDataIDDataReader(4)).ToString()
GradeID.Text = "Grade: " & strGrade & " " & strStrand
'LRN.Text = "LRN: " & UCase(FillDataIDDataReader(7)).ToString()
SY.Text = Date.Today.Year & " - " & (Date.Today.Year + 1)
PersonEmergency.Text =
UCase(FillDataIDDataReader(7)).ToString()
FetcherName.Text = UCase(FillDataIDDataReader(8)).ToString()
FetcherContact.Text = UCase(FillDataIDDataReader(9)).ToString()
Address.Text = UCase(FillDataIDDataReader(10)).ToString()
City.Text = UCase(FillDataIDDataReader(11)).ToString()

FillDataIDConnection.Close()
FillDataIDDataReader.Close()
Return

End If

End If

End If

Catch ex As Exception

MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error Student Data.")


Exit Sub

End Try

Try

Dim RegistrarConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" &
My.Application.Info.DirectoryPath.ToString() & "\BackUp\Database.Accdb;Persist Security
Info=False;")

If RegistrarConnection.State = ConnectionState.Open Then


RegistrarConnection.Close()
RegistrarConnection.Open()

Dim RegistrarDataReader As OleDbDataReader


Dim RegistrarCommand As New OleDbCommand With {
.CommandText = "select
[RegistrarName],[Signature],[Suffix],[GradeLevel] from SchoolInfo where GradeLevel =
'GRADE 12 - SENIOR HIGH SCHOOL'",
.Connection = RegistrarConnection
}
RegistrarDataReader = RegistrarCommand.ExecuteReader

If RegistrarDataReader.Read Then

RegistrarName.Text = UCase(RegistrarDataReader(2)).ToString() &


UCase(RegistrarDataReader(0)).ToString()
Dim byt As Byte() = RegistrarDataReader(1)
Dim ms As New MemoryStream(byt)

Page | 160
PicSignature.Image = Image.FromStream(ms)

End If

Catch ex As Exception

MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error Registrar Data.")


Exit Sub

End Try

End Sub

Private Sub GenarateID_Load(sender As Object, e As EventArgs) Handles MyBase.Load

FillDataID()

PrintID.Show()

End Sub

End Class

Page | 161
LoginForm.vb
Imports System.Data.OleDb
Imports System.Text

Public Class LoginForm

Dim cmd As OleDbCommand = Nothing

Private Sub RoundCorners(obj As Form)

obj.FormBorderStyle = FormBorderStyle.None

Dim DGP As New Drawing2D.GraphicsPath


DGP.StartFigure()

DGP.AddArc(New Rectangle(0, 0, 40, 40), 180, 90)


DGP.AddLine(40, 0, obj.Width - 40, 0)

DGP.AddArc(New Rectangle(obj.Width - 40, 0, 40, 40), -90, 90)


DGP.AddLine(obj.Width, 40, obj.Width, obj.Height - 40)

DGP.AddArc(New Rectangle(obj.Width - 40, obj.Height - 40, 40, 40), 0, 90)


DGP.AddLine(obj.Width - 40, obj.Height, 40, obj.Height)

DGP.AddArc(New Rectangle(0, obj.Height - 40, 40, 40), 90, 90)


DGP.CloseFigure()

obj.Region = New Region(DGP)

End Sub

'Admin, Registrar, and Supervisors


Private Sub BtnAdminLogin_Click(sender As Object, e As EventArgs) Handles
btnAdminLogin.Click

If Len(Trim(txtAdminUsername.Text)) = 0 Then

MessageBox.Show("Please enter username", "Input Error",


MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtAdminUsername.Focus()
Exit Sub

End If

If Len(Trim(txtAdminPassword.Text)) = 0 Then

MessageBox.Show("Please enter password", "Input Error",


MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtAdminPassword.Focus()
Exit Sub

End If

Try

Page | 162
Dim AdminConnection As New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If AdminConnection.State = ConnectionState.Open Then


AdminConnection.Close()
AdminConnection.Open()

Dim AdminDataReader As OleDbDataReader


Dim AdminCommand As New OleDbCommand With {
.CommandText = "SELECT [AdminID],[Password] FROM AdminInfo WHERE
AdminID = @AdminID"
}

' UserName
Dim AdminUsername As New OleDbParameter("@AdminID", OleDbType.VarWChar, 45)
With {
.Value = txtAdminUsername.Text.ToString()
}
AdminCommand.Parameters.Add(AdminUsername)

AdminCommand.Connection = AdminConnection

AdminDataReader = AdminCommand.ExecuteReader

If AdminDataReader.Read Then

If Not AdminDataReader("Password") = Encrypt(txtAdminPassword.Text)


Then

MessageBox.Show("Password is wrong", "Input Error",


MessageBoxButtons.OK, MessageBoxIcon.Warning)

AdminConnection.Close()

AdminForgetPassword.Visible = True

AdminForgetPassword.Text = "Forget Password"

txtAdminPassword.Focus()

Return

Else

Try

AdminConnection.Close()

Dim NameConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")
Dim NameDataReader As OleDbDataReader
Dim NameCommand As New OleDbCommand

If NameConnection.State = ConnectionState.Open Then


NameConnection.Close()
NameConnection.Open()

Page | 163
NameCommand.CommandText = "SELECT [UserName],[Status] FROM
AdminInfo WHERE AdminID = '" & txtAdminUsername.Text & "'"
NameCommand.Connection = NameConnection
NameDataReader = NameCommand.ExecuteReader

If NameDataReader.Read Then

txtUsername.Text = NameDataReader("UserName").ToString
txtPosition.Text = NameDataReader("Status").ToString

AdminConnection.Close()

Try

dtpLoginDate.Value = Now
txtTimeIn.Text = Format(Now, "h:mm:ss tt")

Dim LogConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If LogConnection.State = ConnectionState.Open Then


LogConnection.Close()
LogConnection.Open()

Dim LogString As String = "INSERT INTO LogHistory


([Username],[Position],[LoginDate],[TimeIn],[TimeOut],[Remark]) VALUES ('" &
txtUsername.Text.ToString() & "', '" & txtPosition.Text.ToString() & "', #" &
dtpLoginDate.Text.ToString() & "# ,#" & txtTimeIn.Text.ToString() & "#, ' ', '" &
txtRemark.Text.ToString() & "')"
Dim LogCommand As New OleDbCommand(LogString,
LogConnection)

If LogCommand.ExecuteNonQuery() Then

LogConnection.Close()

cmbFormState.Text = "Admin"

Dim obj As New MainForm


Hide()
obj.Show()

Else

MsgBox("Log History Insert failed",


MsgBoxStyle.Critical, "Log History failed")
Return

End If

Catch ex As Exception

MessageBox.Show(ex.Message, "Error Admin Log History",


MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub

Page | 164
End Try

End If

NameConnection.Close()
NameDataReader.Close()

Return

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Load data error")


Exit Sub

End Try

End If

Else

MessageBox.Show("Username is wrong", "Input Error",


MessageBoxButtons.OK, MessageBoxIcon.Warning)
AdminConnection.Close()

txtAdminUsername.Focus()

Return

End If

Catch ex As Exception

MessageBox.Show(ex.Message, "Error Admin Login Data", MessageBoxButtons.OK,


MessageBoxIcon.Error)
Exit Sub

End Try

End Sub

'Teachers
Private Sub BtnTeacherLogin_Click(sender As Object, e As EventArgs) Handles
btnTeacherLogin.Click

If Len(Trim(txtTeacherUsername.Text)) = 0 Then

MessageBox.Show("Please enter username", "Input Error",


MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtTeacherUsername.Focus()
Exit Sub

End If

If Len(Trim(txtTeacherPassword.Text)) = 0 Then

MessageBox.Show("Please enter password", "Input Error",


MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtTeacherPassword.Focus()

Page | 165
Exit Sub

End If

Try

Dim TeacherConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If TeacherConnection.State = ConnectionState.Open Then


TeacherConnection.Close()
TeacherConnection.Open()

Dim TeacherDataReader As OleDbDataReader


Dim TeacherCommand As New OleDbCommand With {
.CommandText = "SELECT [TeacherID],[Password] FROM TeacherInfo WHERE
TeacherID = @TeacherID"
}

' Username
Dim TeacherUsername As New OleDbParameter("@TeacherID", OleDbType.VarWChar,
45) With {
.Value = txtTeacherUsername.Text.ToString()
}
TeacherCommand.Parameters.Add(TeacherUsername)

TeacherCommand.Connection = TeacherConnection

TeacherDataReader = TeacherCommand.ExecuteReader

If TeacherDataReader.Read Then

If Not TeacherDataReader("Password") = Encrypt(txtTeacherPassword.Text)


Then

MessageBox.Show("Password is wrong", "Input Error",


MessageBoxButtons.OK, MessageBoxIcon.Warning)

TeacherConnection.Close()

TeacherForgetPassword.Visible = True

TeacherForgetPassword.Text = "Forget Password"

txtTeacherPassword.Focus()

Return

Else

Try

Dim NameConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")
Dim NameDataReader As OleDbDataReader
Dim NameCommand As New OleDbCommand

Page | 166
If NameConnection.State = ConnectionState.Open Then
NameConnection.Close()
NameConnection.Open()

NameCommand.CommandText = "SELECT [UserName] FROM TeacherInfo


WHERE TeacherID = '" & txtTeacherUsername.Text & "'"
NameCommand.Connection = NameConnection
NameDataReader = NameCommand.ExecuteReader

If NameDataReader.Read Then

txtUsername.Text = NameDataReader("UserName")
txtPosition.Text = "Teacher"

Try

dtpLoginDate.Value = Now
txtTimeIn.Text = Format(Now, "h:mm:ss tt")

Dim LogConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If LogConnection.State = ConnectionState.Open Then


LogConnection.Close()
LogConnection.Open()

Dim LogString As String = "INSERT INTO LogHistory


([Username],[Position],[LoginDate],[TimeIn],[TimeOut],[Remark]) VALUES ('" &
txtUsername.Text.ToString() & "', '" & txtPosition.Text.ToString() & "', #" &
dtpLoginDate.Text.ToString() & "# ,#" & txtTimeIn.Text.ToString() & "#, ' ', '" &
txtRemark.Text.ToString() & "')"
Dim LogCommand As New OleDbCommand(LogString,
LogConnection)

If LogCommand.ExecuteNonQuery() Then

LogConnection.Close()

cmbFormState.Text = "Teacher"

Dim main As New MainForm


Hide()
main.Show()

Else

MsgBox("Log History Insert failed",


MsgBoxStyle.Critical, "Log History failed")
Return

End If

Catch ex As Exception

MessageBox.Show(ex.Message, "Error Teacher Log


History", MessageBoxButtons.OK, MessageBoxIcon.Error)

Page | 167
Exit Sub

End Try

End If

NameConnection.Close()
NameDataReader.Close()

Return

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Load data error")


Exit Sub

End Try

End If

Else

MessageBox.Show("Username is wrong", "Input Error",


MessageBoxButtons.OK, MessageBoxIcon.Warning)

TeacherConnection.Close()

txtTeacherUsername.Focus()

Return

End If

Catch ex As Exception

MessageBox.Show(ex.Message, "Error Teacher Login Data",


MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub

End Try

End Sub

'Guest
Private Sub BtnEnterAsGuest_Click(sender As Object, e As EventArgs) Handles
btnEnterAsGuest.Click

txtUsername.Text = "Guest"
txtPosition.Text = "Guest"

Try

dtpLoginDate.Value = Now
txtTimeIn.Text = Format(Now, "h:mm:ss tt")

Dim LogConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

Page | 168
If LogConnection.State = ConnectionState.Open Then LogConnection.Close()
LogConnection.Open()

Dim LogString As String = "INSERT INTO LogHistory


([Username],[Position],[LoginDate],[TimeIn],[TimeOut],[Remark]) VALUES ('" &
txtUsername.Text.ToString() & "', '" & txtPosition.Text.ToString() & "', #" &
dtpLoginDate.Text.ToString() & "# ,#" & txtTimeIn.Text.ToString() & "#, ' ', '" &
txtRemark.Text.ToString() & "')"
Dim LogCommand As New OleDbCommand(LogString, LogConnection)

If LogCommand.ExecuteNonQuery() Then

LogConnection.Close()

cmbFormState.Text = "Guest"

Dim Guest As New MainForm


Hide()
Guest.Show()

Else

MsgBox("Log History Insert failed", MsgBoxStyle.Critical, "Log History


failed")
Return

End If

Catch ex As Exception

MessageBox.Show(ex.Message, "Error Guest Log History",


MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub

End Try

End Sub

'Admin Cancel
Private Sub BtnAdminCancel_Click(sender As Object, e As EventArgs) Handles
btnAdminCancel.Click

End

End Sub

'Teacher Cancel
Private Sub BtnTeacherCancel_Click(sender As Object, e As EventArgs) Handles
btnTeacherCancel.Click

End

End Sub

'Admin Forget Password


Private Sub AdminForgetPassword_Click(sender As Object, e As EventArgs) Handles
AdminForgetPassword.Click

Page | 169
Hide()

txtAdminUsername.Text = ""
txtAdminPassword.Text = ""
txtTeacherUsername.Text = ""
txtTeacherPassword.Text = ""

AdminForgetPassword.Visible = False
TeacherForgetPassword.Visible = False

cmbFormState.Text = "Admin"

ForgotPassword.Show()

End Sub

'Teacher Forget Password


Private Sub TeacherForgetPassword_Click(sender As Object, e As EventArgs) Handles
TeacherForgetPassword.Click

Hide()

txtAdminUsername.Text = ""
txtAdminPassword.Text = ""
txtTeacherUsername.Text = ""
txtTeacherPassword.Text = ""

AdminForgetPassword.Visible = False
TeacherForgetPassword.Visible = False

cmbFormState.Text = "Teacher"

ForgotPassword.Show()

End Sub

Private Sub FrmLogin_FormClosing(sender As Object, e As FormClosingEventArgs)


Handles Me.FormClosing

End

End Sub

Private Sub TxtAdminUserName_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtAdminUsername.KeyPress

'Allowed letters numbers and ( _ $ *)


If e.KeyChar <> ControlChars.Back = True Then

If "~`@%^&+={[}]()!:,;'><?/|\-.#+".IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

Page | 170
End Sub

Private Sub TxtAdminPassword_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtAdminPassword.KeyPress

'Allowed letters numbers and ( _ $ *)


If e.KeyChar <> ControlChars.Back = True Then

If "~`@%^&+={[}]()!:,;'><?/|\-.#+".IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtTeacherUsername_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtTeacherUsername.KeyPress

'Allowed letters numbers and ( _ $ *)


If e.KeyChar <> ControlChars.Back = True Then

If "~`@%^&+={[}]()!:,;'><?/|\-.#+".IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtTeacherPassword_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtTeacherPassword.KeyPress

'Allowed letters numbers and ( _ $ *)


If e.KeyChar <> ControlChars.Back = True Then

If "~`@%^&+={[}]()!:,;'><?/|\-.#+".IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub TabControl1_Click(sender As Object, e As EventArgs) Handles


TabControl1.Click

txtAdminUsername.Text = ""
txtAdminPassword.Text = ""
txtTeacherUsername.Text = ""
txtTeacherPassword.Text = ""

Page | 171
End Sub

Private Sub RoundButtonGuest(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand
btn.Font = New Font("Century Gothic", 18)

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(btnEnterAsGuest.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()

btnEnterAsGuest.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonAdminLogin(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(btnAdminLogin.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()

btnAdminLogin.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonAdminCancel(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()

Page | 172
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(btnAdminCancel.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()

btnAdminCancel.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonTeacherLogin(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(btnTeacherLogin.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()

btnTeacherLogin.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonTeacherCancel(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(btnTeacherCancel.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()

btnTeacherCancel.Region = New Region(Raduis)

End Sub

Page | 173
Private Sub LoginForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load

txtTimeIn.Text = Format(Now, "h:mm:ss tt")

RoundCorners(Me)

RoundButtonAdminLogin(btnAdminLogin)
RoundButtonAdminCancel(btnAdminCancel)
RoundButtonTeacherLogin(btnTeacherLogin)
RoundButtonTeacherCancel(btnTeacherCancel)
RoundButtonGuest(btnEnterAsGuest)

End Sub

Private Sub PicHelp1_Click(sender As Object, e As EventArgs) Handles picHelp1.Click

LoginGuide.Show()

picHelp1.Visible = False
picHelp2.Visible = False
picHelp3.Visible = False

End Sub

Private Sub PicHelp2_Click(sender As Object, e As EventArgs) Handles picHelp2.Click

LoginGuide.Show()

picHelp1.Visible = False
picHelp2.Visible = False
picHelp3.Visible = False

End Sub

Private Sub PicHelp3_Click(sender As Object, e As EventArgs) Handles picHelp3.Click

LoginGuide.Show()

picHelp1.Visible = False
picHelp2.Visible = False
picHelp3.Visible = False

End Sub

'Encryption
Public Function Encrypt(Encryption As String) As String

Dim encode As Byte() = New Byte(Encryption.Length - 1) {}


encode = Encoding.UTF8.GetBytes(Encryption)
Dim msg As String = Convert.ToBase64String(encode)
Return msg

End Function

'Decryption
Public Function Decrypt(Decryption As String) As String

Page | 174
Dim encodedtext As New UTF8Encoding
Dim decode As Decoder = encodedtext.GetDecoder
Dim code_byte As Byte() = Convert.FromBase64String(Decryption)
Dim charcount As Integer = decode.GetCharCount(code_byte, 0, code_byte.Length)
Dim decode_char As Char() = New Char(charcount - 1) {}
decode.GetChars(code_byte, 0, code_byte.Length, decode_char, 0)
Dim decryptext As New String(decode_char)
Return decryptext

End Function

End Class

Page | 175
LoginGuide.vb
Imports System.ComponentModel

Public Class LoginGuide

Private Sub LoginGuide_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

Private Sub LoginGuide_Closing(sender As Object, e As CancelEventArgs) Handles


Me.Closing

LoginForm.picHelp1.Visible = True
LoginForm.picHelp2.Visible = True
LoginForm.picHelp3.Visible = True

End Sub

End Class

Page | 176
LoginHistory.vb
Imports System.Data.OleDb
Imports Microsoft.Office.Interop

Public Class LoginHistory

Dim constring As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data


Source=|DataDirectory|\Database\Pre-enrollment.accdb"

Sub Clear()

LogIDTextBox.Text = ""
UsernameTextBox.Text = ""
PositionTextBox.Text = ""
LoginDateDateTimePicker.Value = Now
TimeInTextBox.Text = ""
TimeOutTextBox.Text = ""
RemarkTextBox.Text = ""

End Sub

Private Function Load_Logs(ByVal sSQL As String)

Dim conn As New OleDbConnection


Dim cmd As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dt As New DataTable

Try

conn = New OleDbConnection(constring)


conn.Open()
cmd.Connection = conn
cmd.CommandType = CommandType.Text

cmd.CommandText = sSQL
da.SelectCommand = cmd
da.Fill(dt)

DataGridView1.DataSource = dt
If dt.Rows.Count = 0 Then

Else

lblLogs.Text = "Number of logs: " & DataGridView1.RowCount

End If

Catch ex As Exception

MsgBox(ErrorToString)

Finally

conn.Close()

Page | 177
End Try

End Function

Sub FilterLogs()

If rdoAllDates.Checked Then

Load_Logs("SELECT * FROM LogHistory order by LoginDate DESC")

MonthCalendar1.Enabled = False
PanelSearchUsername.Visible = False

If DataGridView1.CurrentRow Is Nothing Then

Clear()

ElseIf DataGridView1.CurrentRow IsNot DBNull.Value Then

Try

Dim LogID As String = DataGridView1.CurrentRow.Cells(0).Value


LogIDTextBox.Text = LogID

Dim Username As String = DataGridView1.CurrentRow.Cells(1).Value


UsernameTextBox.Text = Username

Dim Position As String = DataGridView1.CurrentRow.Cells(2).Value


PositionTextBox.Text = Position

Dim LoginDate As String = DataGridView1.CurrentRow.Cells(3).Value


LoginDateDateTimePicker.Value = LoginDate

Dim TimeIn As String = DataGridView1.CurrentRow.Cells(4).Value


TimeInTextBox.Text = TimeIn

Dim TimeOut As String = DataGridView1.CurrentRow.Cells(5).Value


TimeOutTextBox.Text = TimeOut

Dim Remark As String = DataGridView1.CurrentRow.Cells(6).Value


RemarkTextBox.Text = Remark

LogIDTextBox.BackColor = Color.White
UsernameTextBox.BackColor = Color.White
PositionTextBox.BackColor = Color.White
LoginDateDateTimePicker.BackColor = Color.White
TimeInTextBox.BackColor = Color.White
TimeOutTextBox.BackColor = Color.White
RemarkTextBox.BackColor = Color.White

lblLogs.Text = "Number of logs: " & DataGridView1.RowCount

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Failed to Load 'Login


Data'")
Exit Sub

Page | 178
End Try

End If

ElseIf rdoSelectedDates.Checked Then

Load_Logs("SELECT * FROM LogHistory WHERE LoginDate>=#" &


MonthCalendar1.SelectionStart & "# AND LoginDate<=#" & MonthCalendar1.SelectionEnd &
"#" & " order by LoginDate DESC")

MonthCalendar1.Enabled = True
PanelSearchUsername.Visible = False

If DataGridView1.CurrentRow Is Nothing Then

Clear()

ElseIf DataGridView1.CurrentRow IsNot DBNull.Value Then

Try

Dim LogID As String = DataGridView1.CurrentRow.Cells(0).Value


LogIDTextBox.Text = LogID

Dim Username As String = DataGridView1.CurrentRow.Cells(1).Value


UsernameTextBox.Text = Username

Dim Position As String = DataGridView1.CurrentRow.Cells(2).Value


PositionTextBox.Text = Position

Dim LoginDate As String = DataGridView1.CurrentRow.Cells(3).Value


LoginDateDateTimePicker.Value = LoginDate

Dim TimeIn As String = DataGridView1.CurrentRow.Cells(4).Value


TimeInTextBox.Text = TimeIn

Dim TimeOut As String = DataGridView1.CurrentRow.Cells(5).Value


TimeOutTextBox.Text = TimeOut

Dim Remark As String = DataGridView1.CurrentRow.Cells(6).Value


RemarkTextBox.Text = Remark

LogIDTextBox.BackColor = Color.White
UsernameTextBox.BackColor = Color.White
PositionTextBox.BackColor = Color.White
LoginDateDateTimePicker.BackColor = Color.White
TimeInTextBox.BackColor = Color.White
TimeOutTextBox.BackColor = Color.White
RemarkTextBox.BackColor = Color.White

lblLogs.Text = "Number of logs: " & DataGridView1.RowCount

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Failed to Load 'Login


Data'")

Page | 179
Exit Sub

End Try

End If

ElseIf rdoUsername.Checked Then

txtSearchUsername.Focus()

Load_Logs("SELECT * FROM LogHistory WHERE Username='" &


txtSearchUsername.Text & "' order by LoginDate DESC")

MonthCalendar1.Enabled = False
PanelSearchUsername.Visible = True

If DataGridView1.CurrentRow Is Nothing Then

Clear()

ElseIf DataGridView1.CurrentRow IsNot DBNull.Value Then

Try

Dim LogID As String = DataGridView1.CurrentRow.Cells(0).Value


LogIDTextBox.Text = LogID

Dim Username As String = DataGridView1.CurrentRow.Cells(1).Value


UsernameTextBox.Text = Username

Dim Position As String = DataGridView1.CurrentRow.Cells(2).Value


PositionTextBox.Text = Position

Dim LoginDate As String = DataGridView1.CurrentRow.Cells(3).Value


LoginDateDateTimePicker.Value = LoginDate

Dim TimeIn As String = DataGridView1.CurrentRow.Cells(4).Value


TimeInTextBox.Text = TimeIn

Dim TimeOut As String = DataGridView1.CurrentRow.Cells(5).Value


TimeOutTextBox.Text = TimeOut

Dim Remark As String = DataGridView1.CurrentRow.Cells(6).Value


RemarkTextBox.Text = Remark

LogIDTextBox.BackColor = Color.White
UsernameTextBox.BackColor = Color.White
PositionTextBox.BackColor = Color.White
LoginDateDateTimePicker.BackColor = Color.White
TimeInTextBox.BackColor = Color.White
TimeOutTextBox.BackColor = Color.White
RemarkTextBox.BackColor = Color.White

lblLogs.Text = "Number of logs: " & DataGridView1.RowCount

Catch ex As Exception

Page | 180
MessageBox.Show(ex.Message.ToString(), "Failed to Load 'Login
Data'")
Exit Sub

End Try

End If

End If

End Sub

Private Sub RoundButtonDeleteAll(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(btnDeleteAll.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()

btnDeleteAll.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonExport(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(btnExport.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()

btnExport.Region = New Region(Raduis)

End Sub

Page | 181
Private Sub LogHistoryBindingNavigatorSaveItem_Click(sender As Object, e As
EventArgs) Handles LogHistoryBindingNavigatorSaveItem.Click
Me.Validate()
Me.LogHistoryBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me._Pre_enrollmentDataSet1)

End Sub

Private Sub LoginHistory_Load(sender As Object, e As EventArgs) Handles MyBase.Load


'TODO: This line of code loads data into the
'_Pre_enrollmentDataSet1.LogHistory' table. You can move, or remove it, as needed.
Me.LogHistoryTableAdapter.Fill(Me._Pre_enrollmentDataSet1.LogHistory)

MonthCalendar1.TodayDate = Now
MonthCalendar1.MaxDate = Now

RoundButtonDeleteAll(btnDeleteAll)
RoundButtonExport(btnExport)

If DataGridView1.CurrentRow Is Nothing Then

Clear()

ElseIf DataGridView1.CurrentRow IsNot DBNull.Value Then

Try

Dim LogID As String = DataGridView1.CurrentRow.Cells(0).Value


LogIDTextBox.Text = LogID

Dim Username As String = DataGridView1.CurrentRow.Cells(1).Value


UsernameTextBox.Text = Username

Dim Position As String = DataGridView1.CurrentRow.Cells(2).Value


PositionTextBox.Text = Position

Dim LoginDate As String = DataGridView1.CurrentRow.Cells(3).Value


LoginDateDateTimePicker.Value = LoginDate

Dim TimeIn As String = DataGridView1.CurrentRow.Cells(4).Value


TimeInTextBox.Text = TimeIn

Dim TimeOut As String = DataGridView1.CurrentRow.Cells(5).Value


TimeOutTextBox.Text = TimeOut

Dim Remark As String = DataGridView1.CurrentRow.Cells(6).Value


RemarkTextBox.Text = Remark

LogIDTextBox.BackColor = Color.White
UsernameTextBox.BackColor = Color.White
PositionTextBox.BackColor = Color.White
LoginDateDateTimePicker.BackColor = Color.White
TimeInTextBox.BackColor = Color.White
TimeOutTextBox.BackColor = Color.White
RemarkTextBox.BackColor = Color.White

lblLogs.Text = "Number of logs: " & DataGridView1.RowCount

Page | 182
Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Failed to Load 'Login Data'")


Exit Sub

End Try

End If

' Auto Completion Search Username


Dim SearchUsernameConnection As New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")
If SearchUsernameConnection.State = ConnectionState.Open Then
SearchUsernameConnection.Close()
SearchUsernameConnection.Open()

Dim SearchUsernameCommand As New OleDbCommand("Select Username from


LogHistory", SearchUsernameConnection)
Dim SearchUsernameDataAdapter As New OleDbDataAdapter(SearchUsernameCommand)
Dim SearchUsernameDataSet As New DataSet
SearchUsernameDataAdapter.Fill(SearchUsernameDataSet)
Dim SearchUsernameColumn As New AutoCompleteStringCollection
Dim j As Integer
For j = 0 To SearchUsernameDataSet.Tables(0).Rows.Count - 1

SearchUsernameColumn.Add(SearchUsernameDataSet.Tables(0).Rows(j)("Username").ToString()
)
Next
txtSearchUsername.AutoCompleteSource = AutoCompleteSource.CustomSource
txtSearchUsername.AutoCompleteCustomSource = SearchUsernameColumn
txtSearchUsername.AutoCompleteMode = AutoCompleteMode.SuggestAppend

End Sub

Private Sub MonthCalendar1_DateChanged(sender As Object, e As DateRangeEventArgs)


Handles MonthCalendar1.DateChanged

If rdoSelectedDates.Checked Then

Load_Logs("SELECT * FROM LogHistory WHERE LoginDate>=#" &


MonthCalendar1.SelectionStart & "# AND LoginDate<=#" & MonthCalendar1.SelectionEnd &
"#")

lblLogs.Text = String.Format("Number of logs: {0}", DataGridView1.RowCount)

End If

End Sub

Private Sub TxtSearchUsername_TextChanged(sender As Object, e As EventArgs) Handles


txtSearchUsername.TextChanged

Load_Logs("SELECT * FROM LogHistory WHERE Username='" & txtSearchUsername.Text


& "' order by LoginDate DESC")

lblLogs.Text = String.Format("Number of logs: {0}", DataGridView1.RowCount)

Page | 183
If DataGridView1.CurrentRow Is Nothing Then

Clear()

ElseIf DataGridView1.CurrentRow IsNot DBNull.Value Then

Try

Dim LogID As String = DataGridView1.CurrentRow.Cells(0).Value


LogIDTextBox.Text = LogID

Dim Username As String = DataGridView1.CurrentRow.Cells(1).Value


UsernameTextBox.Text = Username

Dim Position As String = DataGridView1.CurrentRow.Cells(2).Value


PositionTextBox.Text = Position

Dim LoginDate As String = DataGridView1.CurrentRow.Cells(3).Value


LoginDateDateTimePicker.Value = LoginDate

Dim TimeIn As String = DataGridView1.CurrentRow.Cells(4).Value


TimeInTextBox.Text = TimeIn

Dim TimeOut As String = DataGridView1.CurrentRow.Cells(5).Value


TimeOutTextBox.Text = TimeOut

Dim Remark As String = DataGridView1.CurrentRow.Cells(6).Value


RemarkTextBox.Text = Remark

LogIDTextBox.BackColor = Color.White
UsernameTextBox.BackColor = Color.White
PositionTextBox.BackColor = Color.White
LoginDateDateTimePicker.BackColor = Color.White
TimeInTextBox.BackColor = Color.White
TimeOutTextBox.BackColor = Color.White
RemarkTextBox.BackColor = Color.White

lblLogs.Text = "Number of logs: " & DataGridView1.RowCount

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Failed to Load 'Login Data'")


Exit Sub

End Try

End If

End Sub

Private Sub LogHistoryBindingSource_ListChanged(sender As Object, e As


System.ComponentModel.ListChangedEventArgs) Handles LogHistoryBindingSource.ListChanged

lblLogs.Text = String.Format("Number of logs: {0}", DataGridView1.RowCount)

End Sub

Page | 184
Private Sub RdoAllDates_CheckedChanged(sender As Object, e As EventArgs) Handles
rdoAllDates.CheckedChanged

FilterLogs()

lblLogs.Text = String.Format("Number of logs: {0}", DataGridView1.RowCount)

End Sub

Private Sub RdoSelectedDates_CheckedChanged(sender As Object, e As EventArgs)


Handles rdoSelectedDates.CheckedChanged

FilterLogs()

lblLogs.Text = String.Format("Number of logs: {0}", DataGridView1.RowCount)

End Sub

Private Sub RdoUsername_CheckedChanged(sender As Object, e As EventArgs) Handles


rdoUsername.CheckedChanged

FilterLogs()

lblLogs.Text = String.Format("Number of logs: {0}", DataGridView1.RowCount)

txtSearchUsername.Text = ""

End Sub

Private Sub BtnExport_Click(sender As Object, e As EventArgs) Handles


btnExport.Click
If DataGridView1.RowCount = Nothing Then

MessageBox.Show("Sorry nothing to export into excel sheet.." & vbCrLf &


"Please retrieve data in datagridview", "", MessageBoxButtons.OK, MessageBoxIcon.Error)

Exit Sub

End If

Dim rowsTotal, colsTotal As Short


Dim I, j, iC As Short
Cursor.Current = Cursors.WaitCursor
Dim xlApp As New Excel.Application

Try

Dim excelBook As Excel.Workbook = xlApp.Workbooks.Add


Dim excelWorksheet As Excel.Worksheet = CType(excelBook.Worksheets(1),
Excel.Worksheet)
xlApp.Visible = True

rowsTotal = DataGridView1.RowCount
colsTotal = DataGridView1.Columns.Count - 1

With excelWorksheet

.Cells.Select()

Page | 185
.Cells.Delete()

For iC = 0 To colsTotal

.Cells(1, iC + 1).Value = DataGridView1.Columns(iC).HeaderText

Next

For I = 0 To rowsTotal - 1

For j = 0 To colsTotal

.Cells(I + 2, j + 1).value =
DataGridView1.Rows(I).Cells(j).Value

Next j

Next I

.Rows("1:1").Font.FontStyle = "Bold"
.Rows("1:1").Font.Size = 12

.Cells.Columns.AutoFit()
.Cells.Select()
.Cells.EntireColumn.AutoFit()
.Cells(1, 1).Select()

End With

Catch ex As Exception

MessageBox.Show(ex.Message, "Error on 'Export Excel'",


MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub

Finally

Cursor.Current = Cursors.Default
xlApp = Nothing

End Try

End Sub

Private Sub BtnDeleteAll_Click(sender As Object, e As EventArgs) Handles


btnDeleteAll.Click

Try

If DataGridView1.Rows.Count > 0 Then

If MessageBox.Show("Are you sure want to delete all logs?",


"Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information) =
Windows.Forms.DialogResult.Yes Then

Using conn As New OleDbConnection(constring)

conn.Open()

Page | 186
Dim command As New OleDbCommand("DELETE * from LogHistory",
conn)
command.ExecuteNonQuery()
command.Dispose()
conn.Close()

End Using

Load_Logs("SELECT * FROM LogHistory order by LoginDate DESC")

End If

End If

Catch ex As Exception

MessageBox.Show(ex.Message, "Error on 'Delete All'", MessageBoxButtons.OK,


MessageBoxIcon.Error)
Exit Sub

End Try

End Sub

Private Sub DataGridView1_CellClick(sender As Object, e As


DataGridViewCellEventArgs) Handles DataGridView1.CellClick

Try

Dim LogID As String = DataGridView1.CurrentRow.Cells(0).Value


LogIDTextBox.Text = LogID

Dim Username As String = DataGridView1.CurrentRow.Cells(1).Value


UsernameTextBox.Text = Username

Dim Position As String = DataGridView1.CurrentRow.Cells(2).Value


PositionTextBox.Text = Position

Dim LoginDate As String = DataGridView1.CurrentRow.Cells(3).Value


LoginDateDateTimePicker.Value = LoginDate

Dim TimeIn As String = DataGridView1.CurrentRow.Cells(4).Value


TimeInTextBox.Text = TimeIn

Dim TimeOut As String = DataGridView1.CurrentRow.Cells(5).Value


TimeOutTextBox.Text = TimeOut

Dim Remark As String = DataGridView1.CurrentRow.Cells(6).Value


RemarkTextBox.Text = Remark

LogIDTextBox.BackColor = Color.White
UsernameTextBox.BackColor = Color.White
PositionTextBox.BackColor = Color.White
LoginDateDateTimePicker.BackColor = Color.White
TimeInTextBox.BackColor = Color.White
TimeOutTextBox.BackColor = Color.White
RemarkTextBox.BackColor = Color.White

Page | 187
Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Failed to Load 'Login Data'")


Exit Sub

End Try

End Sub

Private Sub TxtSearchUsername_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtSearchUsername.KeyPress

'Allowed letters numbers and ( _ $ *)


If e.KeyChar <> ControlChars.Back = True Then

If "~`@%^&+={[}]()!:,;'><?/|\-.#+".IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub PicHelp1_Click(sender As Object, e As EventArgs) Handles picHelp1.Click

LoginHistoryGuide.Show()

picHelp1.Visible = False

End Sub

End Class

Page | 188
LoginHistoryGuide.vb
Imports System.ComponentModel

Public Class LoginHistoryGuide

Private Sub LoginHistoryGuide_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

End Sub

Private Sub LoginHistoryGuide_Closing(sender As Object, e As CancelEventArgs)


Handles Me.Closing

LoginHistory.picHelp1.Visible = True

End Sub

Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles


Panel1.Paint

End Sub

End Class

Page | 189
MainForm.vb
Imports System.Data.OleDb
Imports System.IO

Public Class MainForm

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

Private Sub RoundButton(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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(btnStatus.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()

btnStatus.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonEnrollmentPortal(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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(btnEnrollmentPortal.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)

Page | 190
Raduis.AddArc(New Rectangle(0, btn.Height - 20, 20, 20), 90, 90)
Raduis.CloseFigure()

btnEnrollmentPortal.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonEnrollmentDatabase(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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(btnEnrollmentDatabase.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()

btnEnrollmentDatabase.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonTeacherDatabase(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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(btnTeacherDatabase.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()

btnTeacherDatabase.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonPrintID(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

Dim Raduis As New Drawing2D.GraphicsPath

Page | 191
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(btnPrintID.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()

btnPrintID.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonLoginHistory(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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(btnLoginHistory.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()

btnLoginHistory.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonAboutMe(btn As Button)

btn.FlatStyle = FlatStyle.Flat
btn.FlatAppearance.BorderSize = 0
btn.Cursor = Cursors.Hand

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(btnAboutMe.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()

btnAboutMe.Region = New Region(Raduis)

End Sub

Page | 192
Public Sub UserData()

UserInfo.Dispose()
GenarateID.Dispose()
PrintID.Dispose()
TeacherData.Dispose()
StudentEnrollment.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
AboutMe.Dispose()
LoginHistory.Dispose()
AboutMe.Dispose()
CapturePicture.Dispose()
ChangeInfo.Dispose()
ChangePassword.Dispose()
ForgotPassword.Dispose()
GenarateID.Dispose()
LoginGuide.Dispose()
PrintID.Dispose()
StudentEnrollment.Dispose()
StudentEnrollmentGuide.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
TeacherDataGuide.Dispose()
UserInfo.Dispose()

Dim User As New UserInfo


Dispose()
User.Show()

End Sub

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

TimeToolStripStatusLabel.Text = Now.ToLongTimeString.ToString()
TimeToolStripStatusLabel.ForeColor = Color.White

End Sub

Private Sub FrmMain_FormClosing(sender As Object, e As FormClosingEventArgs)


Handles Me.FormClosing

If LoginForm.cmbFormState.Text = "" Then

LoginForm.txtAdminUsername.Text = ""
LoginForm.txtAdminPassword.Text = ""
LoginForm.txtTeacherUsername.Text = ""
LoginForm.txtTeacherPassword.Text = ""
Dispose()
LoginForm.Show()

Return

End If

Page | 193
Try

Dim DatabaseConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")
If DatabaseConnection.State = ConnectionState.Open Then
DatabaseConnection.Close()
DatabaseConnection.Open()

Dim DatabaseDataReader As OleDbDataReader


Dim DatabaseCommand As New OleDbCommand

'Admin
If LoginForm.cmbFormState.Text = "Admin" Then

DatabaseCommand.CommandText = "select [AdminID],[Username] from


AdminInfo where AdminID = '" & LoginForm.txtAdminUsername.Text & "'"
DatabaseCommand.Connection = DatabaseConnection

DatabaseDataReader = DatabaseCommand.ExecuteReader
If DatabaseDataReader.Read Then
Dim intResponse As Integer
intResponse = MessageBox.Show("Do you really want to logout?",
"Response", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If intResponse = MsgBoxResult.No Then
e.Cancel = True
' Exit Sub
Else
MsgBox("Thank you!! " &
DatabaseDataReader("Username").ToString() & vbNewLine & "" & vbNewLine & " God Bless
U...", MsgBoxStyle.Information, "Thank you...")
DatabaseConnection.Close()

Try

txtTimeOut.Text = Format(Now, "h:mm:ss tt")

Dim UpdateConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If UpdateConnection.State = ConnectionState.Open Then


UpdateConnection.Close()
UpdateConnection.Open()

Dim TeacherCommand As New OleDbCommand("Update LogHistory


Set TimeOut=@TimeOut,Remark=@Remark Where (Username='" &
LoginForm.txtUsername.Text.ToString & "' AND LoginDate=#" &
LoginForm.dtpLoginDate.Text.ToString & "# AND TimeIn=#" &
LoginForm.txtTimeIn.Text.ToString & "#)", UpdateConnection)

' TimeOut
Dim TimeOut As New OleDbParameter("@TimeOut",
OleDbType.VarWChar, 50) With {
.Value = txtTimeOut.Text.ToString()
}
TeacherCommand.Parameters.Add(TimeOut)

Page | 194
' Remark
Dim Remark As New OleDbParameter("@Remark",
OleDbType.VarWChar, 50) With {
.Value = txtRemark.Text.ToString()
}
TeacherCommand.Parameters.Add(Remark)

If TeacherCommand.ExecuteNonQuery() Then

UpdateConnection.Close()

Dispose()
LoginForm.Show()
LoginForm.txtAdminUsername.Text = ""
LoginForm.txtAdminPassword.Text = ""
LoginForm.txtTeacherUsername.Text = ""
LoginForm.txtTeacherPassword.Text = ""

Else

MsgBox("Your 'Log out' UPDATE has been failed" &


vbNewLine & vbNewLine & "Please contact your coordinator and take a screenshot for
evidence" & vbNewLine & vbNewLine & "but if your guest please ignore.",
MsgBoxStyle.Critical, "Log Failed")
Return

End If

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Log Error")


Exit Sub

End Try

End If

End If

End If

'Teacher
If LoginForm.cmbFormState.Text = "Teacher" Then

DatabaseCommand.CommandText = "select [TeacherID],[Username] from


TeacherInfo where TeacherID = '" & LoginForm.txtTeacherUsername.Text & "'"
DatabaseCommand.Connection = DatabaseConnection

DatabaseDataReader = DatabaseCommand.ExecuteReader

If DatabaseDataReader.Read Then

Dim intResponse As Integer


intResponse = MessageBox.Show("Do you really want to logout?",
"Response", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

If intResponse = MsgBoxResult.No Then

Page | 195
e.Cancel = True
' Exit Sub

Else

MsgBox("Thank you!! " &


DatabaseDataReader("Username").ToString() & vbNewLine & "" & vbNewLine & " God Bless
U...", MsgBoxStyle.Information, "Thank you...")
DatabaseConnection.Close()

Try

txtTimeOut.Text = Format(Now, "h:mm:ss tt")

Dim UpdateConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If UpdateConnection.State = ConnectionState.Open Then


UpdateConnection.Close()
UpdateConnection.Open()

Dim TeacherCommand As New OleDbCommand("Update LogHistory


Set TimeOut=@TimeOut,Remark=@Remark Where (Username='" &
LoginForm.txtUsername.Text.ToString & "' AND LoginDate=#" &
LoginForm.dtpLoginDate.Text.ToString & "# AND TimeIn=#" &
LoginForm.txtTimeIn.Text.ToString & "#)", UpdateConnection)

' TimeOut
Dim TimeOut As New OleDbParameter("@TimeOut",
OleDbType.VarWChar, 50) With {
.Value = txtTimeOut.Text.ToString()
}
TeacherCommand.Parameters.Add(TimeOut)

' Remark
Dim Remark As New OleDbParameter("@Remark",
OleDbType.VarWChar, 50) With {
.Value = txtRemark.Text.ToString()
}
TeacherCommand.Parameters.Add(Remark)

If TeacherCommand.ExecuteNonQuery() Then

UpdateConnection.Close()

Dispose()
LoginForm.Show()
LoginForm.txtAdminUsername.Text = ""
LoginForm.txtAdminPassword.Text = ""
LoginForm.txtTeacherUsername.Text = ""
LoginForm.txtTeacherPassword.Text = ""

Else

MsgBox("Your 'Log out' UPDATE has been failed" &


vbNewLine & vbNewLine & "Please contact your coordinator and take a screenshot for

Page | 196
evidence" & vbNewLine & vbNewLine & "but if your guest please ignore.",
MsgBoxStyle.Critical, "Log Failed")
Return

End If

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Log Error")


Exit Sub

End Try

End If

End If

End If

'Guest
If LoginForm.cmbFormState.Text = "Guest" Then
Dim intResponse As Integer
intResponse = MessageBox.Show("Do you really want to logout? ",
"Response", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If intResponse = MsgBoxResult.No Then
e.Cancel = True
Exit Sub

Else
MsgBox("Thank you, God Bless...", MsgBoxStyle.Information, "God
Bless U...")
DatabaseConnection.Close()

Try

txtTimeOut.Text = Format(Now, "h:mm:ss tt")

Dim UpdateConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If UpdateConnection.State = ConnectionState.Open Then


UpdateConnection.Close()
UpdateConnection.Open()

Dim TeacherCommand As New OleDbCommand("Update LogHistory Set


TimeOut=@TimeOut,Remark=@Remark Where (Username='" &
LoginForm.txtUsername.Text.ToString & "' AND LoginDate=#" &
LoginForm.dtpLoginDate.Text.ToString & "# AND TimeIn=#" &
LoginForm.txtTimeIn.Text.ToString & "#)", UpdateConnection)

' TimeOut
Dim TimeOut As New OleDbParameter("@TimeOut",
OleDbType.VarWChar, 50) With {
.Value = txtTimeOut.Text.ToString()
}
TeacherCommand.Parameters.Add(TimeOut)

Page | 197
' Remark
Dim Remark As New OleDbParameter("@Remark", OleDbType.VarWChar,
50) With {
.Value = txtRemark.Text.ToString()
}
TeacherCommand.Parameters.Add(Remark)

If TeacherCommand.ExecuteNonQuery() Then

UpdateConnection.Close()

Dispose()
LoginForm.Show()
LoginForm.txtAdminUsername.Text = ""
LoginForm.txtAdminPassword.Text = ""
LoginForm.txtTeacherUsername.Text = ""
LoginForm.txtTeacherPassword.Text = ""

Else

MsgBox("Your 'Log out' UPDATE has been failed" & vbNewLine


& vbNewLine & "Please contact your coordinator and take a screenshot for evidence" &
vbNewLine & vbNewLine & "but if your guest please ignore.", MsgBoxStyle.Critical, "Log
Failed")
Return

End If

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Log Error")


Exit Sub

End Try

End If

End If

Catch ex As Exception

MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error in closing data.")


Exit Sub

End Try

End Sub

Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles Me.Load

RoundButton(btnStatus)
RoundButtonEnrollmentPortal(btnEnrollmentPortal)
RoundButtonEnrollmentDatabase(btnEnrollmentDatabase)
RoundButtonTeacherDatabase(btnTeacherDatabase)
RoundButtonPrintID(btnPrintID)
RoundButtonLoginHistory(btnLoginHistory)
RoundButtonAboutMe(btnAboutMe)

Page | 198
txtTimeOut.Text = Format(Now, "h:mm:ss tt")

DateToolStripStatusLabel.Text = DateTime.Now.ToString("MMM / dd / yyyy")


DateToolStripStatusLabel.ForeColor = Color.White

Try

'Admin, Registrar, and Supervisors


If LoginForm.cmbFormState.Text = "Admin" Then

Dim AdminConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If AdminConnection.State = ConnectionState.Open Then


AdminConnection.Close()
AdminConnection.Open()

Dim AdminDataReader As OleDbDataReader


Dim AdminCommand As New OleDbCommand With {
.CommandText = "SELECT [AdminID],[Username],[Status],[AdminPic]
FROM AdminInfo WHERE AdminID = '" & LoginForm.txtAdminUsername.Text & "'",
.Connection = AdminConnection
}
AdminDataReader = AdminCommand.ExecuteReader
If AdminDataReader.Read Then
Username.Text = AdminDataReader(1).ToString()
UsernameToolStripStatusLabel.Text = AdminDataReader(1).ToString()
btnStatus.Text = AdminDataReader(2).ToString()
btnStatus.Enabled = True

Dim LoadPic As Byte() = AdminDataReader("AdminPic")


Dim Memory As New MemoryStream(LoadPic)
IDPicture.Image = Image.FromStream(Memory)

If (btnStatus.Text = "Registrar" Or btnStatus.Text = "Supervisor")


= True Then

btnTeacherDatabase.Visible = False
TeacherDatabaseToolStripMenuItem.Visible = False
SchoolDatabaseToolStripMenuItem.Visible = False
btnPrintID.Visible = True
AdminToolStripMenuItem1.Visible = True
btnEnrollmentDatabase.Visible = True
btnPrintID.Visible = False
btnLoginHistory.Visible = False

AdminToolStripMenuItem1.Visible = True
TeacherToolStripMenuItem2.Visible = False
GuestToolStripMenuItem3.Visible = False

UsernameToolStripStatusLabel.ForeColor = Color.DarkRed
TimeToolStripStatusLabel.ForeColor = Color.DarkRed

End If

If btnStatus.Text = "Super Admin" = True Then

Page | 199
btnTeacherDatabase.Visible = True
TeacherDatabaseToolStripMenuItem.Visible = True
SchoolDatabaseToolStripMenuItem.Visible = True
btnPrintID.Visible = True
AdminToolStripMenuItem1.Visible = True
btnEnrollmentDatabase.Visible = True
btnPrintID.Visible = True
btnLoginHistory.Visible = True

AdminToolStripMenuItem1.Visible = True
TeacherToolStripMenuItem2.Visible = False
GuestToolStripMenuItem3.Visible = False

UsernameToolStripStatusLabel.ForeColor = Color.Purple
TimeToolStripStatusLabel.ForeColor = Color.Purple

End If

End If

AdminConnection.Close()
AdminDataReader.Close()

Return

End If

'Teachers
If LoginForm.cmbFormState.Text = "Teacher" Then

Dim TeacherConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If TeacherConnection.State = ConnectionState.Open Then


TeacherConnection.Close()
TeacherConnection.Open()

Dim TeacherDataReader As OleDbDataReader


Dim TeacherCommand As New OleDbCommand With {
.CommandText = "SELECT [TeacherID],[Username],[TeacherPic] FROM
TeacherInfo WHERE TeacherID = '" & LoginForm.txtTeacherUsername.Text & "'",
.Connection = TeacherConnection
}

TeacherDataReader = TeacherCommand.ExecuteReader
If TeacherDataReader.Read Then

Username.Text = TeacherDataReader(1).ToString()
UsernameToolStripStatusLabel.Text = TeacherDataReader(1).ToString()
btnStatus.Text = "Teacher"
btnStatus.Enabled = True

Dim LoadPic As Byte() = TeacherDataReader("TeacherPic")


Dim Memory As New MemoryStream(LoadPic)
IDPicture.Image = Image.FromStream(Memory)

Page | 200
AdministratorToolStripMenuItem.Visible = False

AdminToolStripMenuItem1.Visible = False
TeacherToolStripMenuItem2.Visible = True
GuestToolStripMenuItem3.Visible = False

btnTeacherDatabase.Visible = False
btnEnrollmentDatabase.Visible = False
btnPrintID.Visible = False
btnLoginHistory.Visible = False

UsernameToolStripStatusLabel.ForeColor = Color.Green
TimeToolStripStatusLabel.ForeColor = Color.Green

End If

TeacherConnection.Close()
TeacherDataReader.Close()

Return

End If

'Guest
If LoginForm.cmbFormState.Text = "Guest" Then

Username.Text = "Guest"
btnStatus.Text = "Guest"
btnStatus.Enabled = False
btnStatus.ForeColor = Color.White

AdministratorToolStripMenuItem.Visible = False
btnTeacherDatabase.Visible = False
btnEnrollmentDatabase.Visible = False
btnPrintID.Visible = False
btnLoginHistory.Visible = False

AdminToolStripMenuItem1.Visible = False
TeacherToolStripMenuItem2.Visible = False
GuestToolStripMenuItem3.Visible = True

UsernameToolStripStatusLabel.ForeColor = Color.Black
TimeToolStripStatusLabel.ForeColor = Color.Black

End If

Catch ex As Exception

MsgBox(ex.Message(), MsgBoxStyle.Critical, "Load Data Error")


Exit Sub

End Try

End Sub

Private Sub PicClose_Click(sender As Object, e As EventArgs) Handles picClose.Click

Close()

Page | 201
End Sub

Private Sub PicMinimize_Click(sender As Object, e As EventArgs) Handles


PicMinimize.Click

WindowState = FormWindowState.Minimized

End Sub

Private Sub EnrollmentPortalToolStripMenuItem_Click(sender As Object, e As


EventArgs) Handles EnrollmentPortalToolStripMenuItem.Click

StudentEnrollment.Show()

End Sub
Private Sub BtnStatus_Click(sender As Object, e As EventArgs) Handles
btnStatus.Click

UserData()

End Sub

Private Sub BtnEnrollment_Click(sender As Object, e As EventArgs) Handles


btnEnrollmentPortal.Click

StudentEnrollment.Show()

End Sub

Private Sub BtnTeacherDatabase_Click(sender As Object, e As EventArgs) Handles


btnTeacherDatabase.Click

UserInfo.Hide()
GenarateID.Hide()
PrintID.Hide()
TeacherData.Hide()
StudentEnrollment.Hide()
StudentSubject.Hide()
StudentRequirements.Hide()
StudentRegistered.Hide()
AboutMe.Hide()
LoginHistory.Hide()

UserInfo.Dispose()
GenarateID.Dispose()
PrintID.Dispose()
TeacherData.Dispose()
StudentEnrollment.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
AboutMe.Dispose()
LoginHistory.Dispose()
AboutMe.Dispose()
CapturePicture.Dispose()
ChangeInfo.Dispose()
ChangePassword.Dispose()

Page | 202
ForgotPassword.Dispose()
GenarateID.Dispose()
LoginGuide.Dispose()
PrintID.Dispose()
StudentEnrollment.Dispose()
StudentEnrollmentGuide.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
TeacherDataGuide.Dispose()
UserInfo.Dispose()

Dim newmdichild As New TeacherData With {


.MdiParent = Me
}
newmdichild.Show()

OpenChildForm(New TeacherData())

End Sub

Private Sub BtnEnrollmentDatabase_Click(sender As Object, e As EventArgs) Handles


btnEnrollmentDatabase.Click

UserInfo.Hide()
GenarateID.Hide()
PrintID.Hide()
TeacherData.Hide()
StudentEnrollment.Hide()
StudentSubject.Hide()
StudentRequirements.Hide()
StudentRegistered.Hide()
AboutMe.Hide()
LoginHistory.Hide()

UserInfo.Dispose()
GenarateID.Dispose()
PrintID.Dispose()
TeacherData.Dispose()
StudentEnrollment.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
AboutMe.Dispose()
LoginHistory.Dispose()
AboutMe.Dispose()
CapturePicture.Dispose()
ChangeInfo.Dispose()
ChangePassword.Dispose()
ForgotPassword.Dispose()
GenarateID.Dispose()
LoginGuide.Dispose()
PrintID.Dispose()
StudentEnrollment.Dispose()
StudentEnrollmentGuide.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()

Page | 203
TeacherDataGuide.Dispose()
UserInfo.Dispose()

Dim newmdichild As New EnrollmentData With {


.MdiParent = Me
}
newmdichild.Show()

OpenChildForm(New EnrollmentData())

End Sub

Private Sub BtnPrintID_Click(sender As Object, e As EventArgs) Handles


btnPrintID.Click

GenarateID.Show()

End Sub

Private Sub ToolStripMenuItem10_Click(sender As Object, e As EventArgs) Handles


EnrollmentDataMenuItem10.Click

UserInfo.Hide()
GenarateID.Hide()
PrintID.Hide()
TeacherData.Hide()
StudentEnrollment.Hide()
StudentSubject.Hide()
StudentRequirements.Hide()
StudentRegistered.Hide()
AboutMe.Hide()
LoginHistory.Hide()

UserInfo.Dispose()
GenarateID.Dispose()
PrintID.Dispose()
TeacherData.Dispose()
StudentEnrollment.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
AboutMe.Dispose()
LoginHistory.Dispose()
AboutMe.Dispose()
CapturePicture.Dispose()
ChangeInfo.Dispose()
ChangePassword.Dispose()
ForgotPassword.Dispose()
GenarateID.Dispose()
LoginGuide.Dispose()
PrintID.Dispose()
StudentEnrollment.Dispose()
StudentEnrollmentGuide.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
TeacherDataGuide.Dispose()
UserInfo.Dispose()

Page | 204
Dim newmdichild As New EnrollmentData With {
.MdiParent = Me
}
newmdichild.Show()

OpenChildForm(New EnrollmentData())

End Sub

Private Sub DToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles


TeacherDataMenuItem.Click

UserInfo.Hide()
GenarateID.Hide()
PrintID.Hide()
TeacherData.Hide()
StudentEnrollment.Hide()
StudentSubject.Hide()
StudentRequirements.Hide()
StudentRegistered.Hide()
AboutMe.Hide()
LoginHistory.Hide()

UserInfo.Dispose()
GenarateID.Dispose()
PrintID.Dispose()
TeacherData.Dispose()
StudentEnrollment.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
AboutMe.Dispose()
LoginHistory.Dispose()
AboutMe.Dispose()
CapturePicture.Dispose()
ChangeInfo.Dispose()
ChangePassword.Dispose()
ForgotPassword.Dispose()
GenarateID.Dispose()
LoginGuide.Dispose()
PrintID.Dispose()
StudentEnrollment.Dispose()
StudentEnrollmentGuide.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
TeacherDataGuide.Dispose()
UserInfo.Dispose()

Dim newmdichild As New TeacherData With {


.MdiParent = Me
}
newmdichild.Show()

OpenChildForm(New TeacherData())

End Sub

Page | 205
Private Sub EnrollmentPortalToolStripMenuItem1_Click(sender As Object, e As
EventArgs) Handles EnrollmentPortalToolStripMenuItem1.Click

StudentEnrollment.Show()

End Sub

Private Sub EnrollmentDatabaseToolStripMenuItem_Click(sender As Object, e As


EventArgs) Handles EnrollmentDatabaseToolStripMenuItem.Click

UserInfo.Hide()
GenarateID.Hide()
PrintID.Hide()
TeacherData.Hide()
StudentEnrollment.Hide()
StudentSubject.Hide()
StudentRequirements.Hide()
StudentRegistered.Hide()
AboutMe.Hide()
LoginHistory.Hide()

UserInfo.Dispose()
GenarateID.Dispose()
PrintID.Dispose()
TeacherData.Dispose()
StudentEnrollment.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
AboutMe.Dispose()
LoginHistory.Dispose()
AboutMe.Dispose()
CapturePicture.Dispose()
ChangeInfo.Dispose()
ChangePassword.Dispose()
ForgotPassword.Dispose()
GenarateID.Dispose()
LoginGuide.Dispose()
PrintID.Dispose()
StudentEnrollment.Dispose()
StudentEnrollmentGuide.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
TeacherDataGuide.Dispose()
UserInfo.Dispose()

Dim newmdichild As New EnrollmentData With {


.MdiParent = Me
}
newmdichild.Show()

OpenChildForm(New EnrollmentData())

End Sub

Page | 206
Private Sub TeacherDatabaseToolStripMenuItem_Click(sender As Object, e As
EventArgs) Handles TeacherDatabaseToolStripMenuItem.Click

UserInfo.Hide()
GenarateID.Hide()
PrintID.Hide()
TeacherData.Hide()
StudentEnrollment.Hide()
StudentSubject.Hide()
StudentRequirements.Hide()
StudentRegistered.Hide()
AboutMe.Hide()
LoginHistory.Hide()

UserInfo.Dispose()
GenarateID.Dispose()
PrintID.Dispose()
TeacherData.Dispose()
StudentEnrollment.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
AboutMe.Dispose()
LoginHistory.Dispose()
AboutMe.Dispose()
CapturePicture.Dispose()
ChangeInfo.Dispose()
ChangePassword.Dispose()
ForgotPassword.Dispose()
GenarateID.Dispose()
LoginGuide.Dispose()
PrintID.Dispose()
StudentEnrollment.Dispose()
StudentEnrollmentGuide.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
TeacherDataGuide.Dispose()
UserInfo.Dispose()

Dim newmdichild As New TeacherData With {


.MdiParent = Me
}
newmdichild.Show()

OpenChildForm(New TeacherData())

End Sub

Private Sub BtnAboutMe_Click(sender As Object, e As EventArgs) Handles


btnAboutMe.Click

UserInfo.Hide()
GenarateID.Hide()
PrintID.Hide()
TeacherData.Hide()
StudentEnrollment.Hide()

Page | 207
StudentSubject.Hide()
StudentRequirements.Hide()
StudentRegistered.Hide()
AboutMe.Hide()
LoginHistory.Hide()

UserInfo.Dispose()
GenarateID.Dispose()
PrintID.Dispose()
TeacherData.Dispose()
StudentEnrollment.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
AboutMe.Dispose()
LoginHistory.Dispose()
AboutMe.Dispose()
CapturePicture.Dispose()
ChangeInfo.Dispose()
ChangePassword.Dispose()
ForgotPassword.Dispose()
GenarateID.Dispose()
LoginGuide.Dispose()
PrintID.Dispose()
StudentEnrollment.Dispose()
StudentEnrollmentGuide.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
TeacherDataGuide.Dispose()
UserInfo.Dispose()

Dim newmdichild As New AboutMe With {


.MdiParent = Me
}
newmdichild.Show()

OpenChildForm(New AboutMe())

End Sub

Private Sub BtnLoginHistory_Click(sender As Object, e As EventArgs) Handles


btnLoginHistory.Click

UserInfo.Hide()
GenarateID.Hide()
PrintID.Hide()
TeacherData.Hide()
StudentEnrollment.Hide()
StudentSubject.Hide()
StudentRequirements.Hide()
StudentRegistered.Hide()
AboutMe.Hide()
LoginHistory.Hide()

UserInfo.Dispose()
GenarateID.Dispose()
PrintID.Dispose()

Page | 208
TeacherData.Dispose()
StudentEnrollment.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
AboutMe.Dispose()
LoginHistory.Dispose()
AboutMe.Dispose()
CapturePicture.Dispose()
ChangeInfo.Dispose()
ChangePassword.Dispose()
ForgotPassword.Dispose()
GenarateID.Dispose()
LoginGuide.Dispose()
PrintID.Dispose()
StudentEnrollment.Dispose()
StudentEnrollmentGuide.Dispose()
StudentSubject.Dispose()
StudentRequirements.Dispose()
StudentRegistered.Dispose()
TeacherDataGuide.Dispose()
UserInfo.Dispose()

Dim newmdichild As New LoginHistory With {


.MdiParent = Me
}
newmdichild.Show()

OpenChildForm(New LoginHistory())

End Sub

Private Sub PrintIDToolStripMenuItem_Click(sender As Object, e As EventArgs)


Handles PrintIDToolStripMenuItem.Click

GenarateID.Show()

End Sub

Private Sub EnrollmentPortalToolStripMenuItem2_Click(sender As Object, e As


EventArgs) Handles EnrollmentPortalToolStripMenuItem2.Click

StudentEnrollment.Show()

End Sub

Private Sub EnrollmentPortalToolStripMenuItem3_Click(sender As Object, e As


EventArgs) Handles EnrollmentPortalToolStripMenuItem3.Click

StudentEnrollment.Show()

End Sub

End Class

Page | 209
PrintID.vb
Public Class PrintID

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

PrintDialog1.Document = PrintDocument1
PrintDialog1.PrinterSettings = PrintDocument1.PrinterSettings
PrintDialog1.AllowSomePages = True

If PrintDialog1.ShowDialog = DialogResult.OK Then

PrintDocument1.PrinterSettings = PrintDialog1.PrinterSettings
PrintDocument1.Print()

End If

End Sub

Private Sub PrintID_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

End Class

Page | 210
StudentEnrollment.vb
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
}

Page | 211
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

Page | 212
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

Page | 213
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 = ""

Page | 214
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)

Page | 215
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)

Page | 216
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

Page | 217
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()

Page | 218
ChangeConnection.Open()

Dim ChangeCommand As New OleDbCommand("Update EnrollmentData Set


StudentNumber=@SNum,GradeLevel=@SGrade,Strand=@Strand,Semester=@Semester,SchoolYear=@Sc
hoolYear,Lastname=@Lastname,Firstname=@Firstname,Middlename=@Middlename,Age=@Age,DOB=@D
OB,Sex=@Sex,POB=@POB,Nationality=@Nationality,Religion=@Religion,Email=@Email,MobileNum
ber=@MobileNumber,TelephoneNumber=@TelephoneNumber,Address=@Address,City=@City,FatherNa
me=@FName,FatherOccupation=@FOccupation,FatherEmail=@FEmail,FatherWorkAddress=@FWorkAdd
ress,FatherContactNumber=@FContactNumber,MotherName=@MName,MotherOccupation=@MOccupatio
n,MotherEmail=@MEmail,MotherWorkAddress=@MWorkAddress,MotherContactNumber=@MContactNumb
er,NumberOfSiblings=@NumOfSiblings,PersonEmergency=@PersonEmergency,GuardianName=@GName
,GuardianRelation=@GRelation,GuardianEmail=@GEmail,GuardianWorkAddress=@GWorkAddress,Gu
ardianContactNumber=@GContactNumber,FetcherName=@FetcherName,FetcherContactNumber=@Fetc
herContactNumber,SiblingsOfStudent1=@SiblingsOfStudent1,SiblingsOfStudent2=@SiblingsOfS
tudent2,SiblingsOfStudent3=@SiblingsOfStudent3,SiblingsOfStudentAge1=@SiblingsOfStudent
Age1,SiblingsOfStudentAge2=@SiblingsOfStudentAge2,SiblingsOfStudentAge3=@SiblingsOfStud
entAge3,SiblingsOfStudentSchool1=@SiblingsOfStudentSchool1,SiblingsOfStudentSchool2=@Si
blingsOfStudentSchool2,SiblingsOfStudentSchool3=@SiblingsOfStudentSchool3,SchoolLastAtt
ended1=@SchoolLastAttended1,SchoolLastAttended2=@SchoolLastAttended2,SchoolLastAttended
3=@SchoolLastAttended3,AcademicYear1=@AYear1,AcademicYear2=@AYear2,AcademicYear3=@AYear
3,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)

Page | 219
' 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)

Page | 220
' 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 {

Page | 221
.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 {

Page | 222
.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 {

Page | 223
.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()

Page | 224
}
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)

Page | 225
' 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,M
iddlename,Age,DOB,Sex,POB,Nationality,Religion,Email,MobileNumber,TelephoneNumber,Addre
ss,City,FatherName,FatherOccupation,FatherEmail,FatherWorkAddress,FatherContactNumber,M

Page | 226
otherName,MotherOccupation,MotherEmail,MotherWorkAddress,MotherContactNumber,NumberOfSi
blings,PersonEmergency,GuardianName,GuardianRelation,GuardianEmail,GuardianWorkAddress,
GuardianContactNumber,FetcherName,FetcherContactNumber,SiblingsOfStudent1,SiblingsOfStu
dent2,SiblingsOfStudent3,SiblingsOfStudentAge1,SiblingsOfStudentAge2,SiblingsOfStudentA
ge3,SiblingsOfStudentSchool1,SiblingsOfStudentSchool2,SiblingsOfStudentSchool3,SchoolLa
stAttended1,SchoolLastAttended2,SchoolLastAttended3,AcademicYear1,AcademicYear2,Academi
cYear3,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,@d5
3,@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()

Page | 227
}
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)

Page | 228
' 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

Page | 229
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)

' Number of Siblings


Dim NumberOfSiblings As New OleDbParameter("@d30", OleDbType.VarWChar,
10) With {
.Value = txtNoOfSiblings.Text.ToString()
}
NextCommand.Parameters.Add(NumberOfSiblings)

' Person in case of Emergency


Dim PersonEmergency As New OleDbParameter("@d31", OleDbType.VarWChar,
15)
If rdoFather.Checked Then
PersonEmergency.Value = rdoFather.Text.ToString()

ElseIf rdoMother.Checked Then


PersonEmergency.Value = rdoMother.Text.ToString()

Page | 230
ElseIf rdoOthers.Checked Then
PersonEmergency.Value = rdoOthers.Text.ToString()

End If
NextCommand.Parameters.Add(PersonEmergency)

' Guardian Name


Dim GuardianName As New OleDbParameter("@d32", OleDbType.VarWChar, 50)
With {
.Value = txtGuardianName.Text.ToString()
}
NextCommand.Parameters.Add(GuardianName)

' Guardian Relation


Dim GuardianRelation As New OleDbParameter("@d33", OleDbType.VarWChar,
25) With {
.Value = txtGuardianRelation.Text.ToString()
}
NextCommand.Parameters.Add(GuardianRelation)

' Guardian Email


Dim GuardianEmail As New OleDbParameter("@d34", OleDbType.VarWChar, 30)
With {
.Value = txtGuardianEmail.Text.ToString()
}
NextCommand.Parameters.Add(GuardianEmail)

' Guardian Work Address


Dim GuardianWorkAddress As New OleDbParameter("@d35",
OleDbType.VarWChar, 40) With {
.Value = txtGuardianWorkAddress.Text.ToString()
}
NextCommand.Parameters.Add(GuardianWorkAddress)

' Guardian Contact Number


Dim GuardianContactNumber As New OleDbParameter("@d36",
OleDbType.VarWChar, 20) With {
.Value = String.Format("{0:(0#) ##-###-####}",
txtGuardianContactNo.Text).ToString
}
NextCommand.Parameters.Add(GuardianContactNumber)

' Fetcher Name


Dim FetcherName As New OleDbParameter("@d37", OleDbType.VarWChar, 50)
With {
.Value = txtFetcherName.Text.ToString()
}
NextCommand.Parameters.Add(FetcherName)

' Fetcher Contact Number


Dim FetcherContactNumber As New OleDbParameter("@d38",
OleDbType.VarWChar, 20) With {
.Value = String.Format("{0:(0#) ##-###-####}",
txtFetcherContactNo.Text).ToString
}
NextCommand.Parameters.Add(FetcherContactNumber)

Page | 231
' Siblings of Student 1
Dim SiblingsOfStudent1 As New OleDbParameter("@d39",
OleDbType.VarWChar, 50) With {
.Value = txtSiblingsofStudent1.Text.ToString()
}
NextCommand.Parameters.Add(SiblingsOfStudent1)

' Siblings of Student 2


Dim SiblingsOfStudent2 As New OleDbParameter("@d40",
OleDbType.VarWChar, 50) With {
.Value = txtSiblingsofStudent1.Text.ToString()
}
NextCommand.Parameters.Add(SiblingsOfStudent2)

' Siblings of Student 3


Dim SiblingsOfStudent3 As New OleDbParameter("@d41",
OleDbType.VarWChar, 50) With {
.Value = txtSiblingsofStudent1.Text.ToString()
}
NextCommand.Parameters.Add(SiblingsOfStudent3)

' Siblings of StudentAge 1


Dim SiblingsOfStudentAge1 As New OleDbParameter("@d42",
OleDbType.VarWChar, 10) With {
.Value = txtSiblingsAge1.Text.ToString()
}
NextCommand.Parameters.Add(SiblingsOfStudentAge1)

' Siblings of StudentAge 2


Dim SiblingsOfStudentAge2 As New OleDbParameter("@d43",
OleDbType.VarWChar, 10) With {
.Value = txtSiblingsAge2.Text.ToString()
}
NextCommand.Parameters.Add(SiblingsOfStudentAge2)

' Siblings of StudentAge 3


Dim SiblingsOfStudentAge3 As New OleDbParameter("@d44",
OleDbType.VarWChar, 10) With {
.Value = txtSiblingsAge3.Text.ToString()
}
NextCommand.Parameters.Add(SiblingsOfStudentAge3)

' Siblings of StudentSchool 1


Dim SiblingsOfStudentSchool1 As New OleDbParameter("@d45",
OleDbType.VarWChar, 40) With {
.Value = txtSiblingsSchool1.Text.ToString()
}
NextCommand.Parameters.Add(SiblingsOfStudentSchool1)

' Siblings of StudentSchool 2


Dim SiblingsOfStudentSchool2 As New OleDbParameter("@d46",
OleDbType.VarWChar, 40) With {
.Value = txtSiblingsSchool2.Text.ToString()
}
NextCommand.Parameters.Add(SiblingsOfStudentSchool2)

' Siblings of StudentSchool 3

Page | 232
Dim SiblingsOfStudentSchool3 As New OleDbParameter("@d47",
OleDbType.VarWChar, 40) With {
.Value = txtSiblingsSchool3.Text.ToString()
}
NextCommand.Parameters.Add(SiblingsOfStudentSchool3)

' School Last Attended 1


Dim SchoolLastAttended1 As New OleDbParameter("@d48",
OleDbType.VarWChar, 50) With {
.Value = txtSchoolLastAttended1.Text.ToString()
}
NextCommand.Parameters.Add(SchoolLastAttended1)

' School Last Attended 2


Dim SchoolLastAttended2 As New OleDbParameter("@d49",
OleDbType.VarWChar, 50) With {
.Value = txtSchoolLastAttended2.Text.ToString()
}
NextCommand.Parameters.Add(SchoolLastAttended2)

' School Last Attended 3


Dim SchoolLastAttended3 As New OleDbParameter("@d50",
OleDbType.VarWChar, 50) With {
.Value = txtSchoolLastAttended3.Text.ToString()
}
NextCommand.Parameters.Add(SchoolLastAttended3)

' Academic Year 1


Dim AcademicYear1 As New OleDbParameter("@d51", OleDbType.VarWChar, 20)
With {
.Value = txtAcademicYear1.Text.ToString()
}
NextCommand.Parameters.Add(AcademicYear1)

' Academic Year 2


Dim AcademicYear2 As New OleDbParameter("@d52", OleDbType.VarWChar, 20)
With {
.Value = txtAcademicYear2.Text.ToString()
}
NextCommand.Parameters.Add(AcademicYear2)

' Academic Year 3


Dim AcademicYear3 As New OleDbParameter("@d53", OleDbType.VarWChar, 20)
With {
.Value = txtAcademicYear3.Text.ToString()
}
NextCommand.Parameters.Add(AcademicYear3)

' Reason for Applying


Dim ReasonApplying As New OleDbParameter("@d54", OleDbType.VarWChar,
500) With {
.Value = txtReasonApplying.Text.ToString()
}
NextCommand.Parameters.Add(ReasonApplying)

'Identifier (for sequencial forms)


Dim Identifier As New OleDbParameter("@d55", OleDbType.Date, 45) With {
.Value = dtbIdentify.Text.ToString()

Page | 233
}
NextCommand.Parameters.Add(Identifier)

Dim MemStream As New MemoryStream


Dim StudentPic_Upload As Byte()

StudentPic.Image.Save(MemStream, Imaging.ImageFormat.Png)
StudentPic_Upload = MemStream.GetBuffer()
MemStream.Read(StudentPic_Upload, 0, MemStream.Length)

' Student ID Picture


Dim StudentPicture As New OleDbParameter("@d56", SqlDbType.Image) With
{
.Value = StudentPic_Upload
}
NextCommand.Parameters.Add(StudentPicture)

' Status
Dim Status As New OleDbParameter("@d57", OleDbType.VarWChar, 30) With {
.Value = "reserved"
}
NextCommand.Parameters.Add(Status)

If NextCommand.ExecuteNonQuery() Then

Try

NextConnection.Close()
MsgBox("New student pre-enrolled successfully.",
MsgBoxStyle.Information, "Successfully pre-enrolled!")

Dim NameConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")
Dim NameDataReader As OleDbDataReader
Dim NameCommand As New OleDbCommand

If NameConnection.State = ConnectionState.Open Then


NameConnection.Close()
NameConnection.Open()

NameCommand.CommandText = "SELECT
[Lastname],[Firstname],[Middlename],[EnrollmentNumber] FROM EnrollmentData WHERE
Lastname = '" & txtLastname.Text & "' AND Firstname = '" & txtFirstname.Text & "' AND
Middlename = '" & txtMiddlename.Text & "'"
NameCommand.Connection = NameConnection
NameDataReader = NameCommand.ExecuteReader

If NameDataReader.Read Then

txtEnrollmentNo.Text = NameDataReader("EnrollmentNumber")

PictureBox1.Visible = False
Panel1.Visible = False
PictureBox2.Visible = False

btnNext.Text = " Change "

Page | 234
Subject()

End If

NameConnection.Close()
NameDataReader.Close()

Return

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Data Error")


Exit Sub

End Try

Else

MsgBox("New Student enrollment failed.", MsgBoxStyle.Critical,


"Enrollment failed")
Return

End If

ElseIf btnNext.Text = " Next " Then

StudentSubject.Dispose()
Subject()

ElseIf btnNext.Text = " Change " Then

StudentSubject.Dispose()
Subject()

End If

Catch ex As Exception

MessageBox.Show(ex.Message.ToString(), "Enrollment Error")


Exit Sub

End Try

End Sub

Private Sub TxtStudentNumber_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtStudentNumber.KeyPress

'Allowed Numbers and "-" only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 45 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

Page | 235
End If

End Sub

Private Sub TxtLastname_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


txtLastname.KeyPress

'Allowed Letters only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "1234567890~`@#$%^&*()_-+={[}]:;',!.><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtFirstname_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


txtFirstname.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtMiddlename_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtMiddlename.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtAge_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


txtAge.KeyPress

Page | 236
'Allowed Numbers only
If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtPOB_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


txtPOB.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtNationality_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtNationality.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtReligion_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


txtReligion.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

Page | 237
End If

End If

End Sub

Private Sub TxtMobileNo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


txtMobileNo.KeyPress
'Allowed Numbers only
If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtTelephoneNo_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtTelephoneNo.KeyPress
'Allowed Numbers only
If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtStudentAddress1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtStudentAddress1.KeyPress

'Allowed Letters, Number and "." only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "~`@#$%^&*()_-+={[}]:;',!><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtStudentAddress2_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtStudentAddress2.KeyPress

'Allowed Letters, Number and "." only


If e.KeyChar <> ControlChars.Back Then

Page | 238
Dim NotAllowed As String = "~`@#$%^&*()_-+={[}]:;',!><?/|\"
If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtFatherName_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtFatherName.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtFatherOccupation_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtFatherOccupation.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtFatherEmail_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtFatherEmail.KeyPress

'Allowed all

End Sub

Private Sub TxtFatherWorkAddress_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtFatherWorkAddress.KeyPress

'Allowed Letters, Number and "." only


If e.KeyChar <> ControlChars.Back Then

Page | 239
Dim NotAllowed As String = "~`@#$%^&*()_-+={[}]:;',!><?/|\"
If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtFatherContactNo_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtFatherContactNo.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtMotherName_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtMotherName.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtMotherOccupation_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtMotherOccupation.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

Page | 240
End If

End Sub

Private Sub TxtMotherEmail_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtMotherEmail.KeyPress

'Allowed all

End Sub

Private Sub TxtMotherWorkAddress_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtMotherWorkAddress.KeyPress

'Allowed Letters, Number and "." only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "~`@#$%^&*()_-+={[}]:;',!><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtMotherContactNo_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtMotherContactNo.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtNoOfSiblings_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtNoOfSiblings.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

Page | 241
End Sub

Private Sub TxtGuardianName_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtGuardianName.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtGuardianRelation_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtGuardianRelation.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtGuardianEmail_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtGuardianEmail.KeyPress

'Allowed all

End Sub

Private Sub TxtGuardianWorkAddress_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles txtGuardianWorkAddress.KeyPress

'Allowed Letters, Number and "." only


If e.KeyChar <> ControlChars.Back Then

Dim NotAllowed As String = "~`@#$%^&*()_-+={[}]:;',!><?/|\"


If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then

e.Handled = True

End If

End If

Page | 242
End Sub

Private Sub TxtGuardianContactNo_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtGuardianContactNo.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtFetcherName_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtFetcherName.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtFetcherContactNo_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtFetcherContactNo.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtSiblingsofStudent1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles txtSiblingsofStudent1.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

Page | 243
If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or
Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtSiblingsofStudent2_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles txtSiblingsofStudent2.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtSiblingsofStudent3_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles txtSiblingsofStudent3.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtSiblingsAge1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtSiblingsAge1.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

Page | 244
End Sub

Private Sub TxtSiblingsAge2_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtSiblingsAge2.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtSiblingsAge3_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtSiblingsAge3.KeyPress

'Allowed Numbers only


If Asc(e.KeyChar) <> 8 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtSiblingsSchool1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtSiblingsSchool1.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtSiblingsSchool2_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtSiblingsSchool2.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

Page | 245
If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or
Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtSiblingsSchool3_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtSiblingsSchool3.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtSchoolLastAttended1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles txtSchoolLastAttended1.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtSchoolLastAttended2_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles txtSchoolLastAttended2.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

Page | 246
End If

End Sub

Private Sub TxtSchoolLastAttended3_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles txtSchoolLastAttended3.KeyPress

'Allowed Letters only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 32 Then

If (Asc(e.KeyChar) < 65 Or Asc(e.KeyChar) > 90) And (Asc(e.KeyChar) < 97 Or


Asc(e.KeyChar) > 122) Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtAcademicYear1_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtAcademicYear1.KeyPress

'Allowed Numbers and "-" only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 45 And Asc(e.KeyChar) <> 32 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtAcademicYear2_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtAcademicYear2.KeyPress

'Allowed Numbers and "-" only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 45 And Asc(e.KeyChar) <> 32 Then

If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtAcademicYear3_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtAcademicYear3.KeyPress

'Allowed Numbers and "-" only


If Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 45 And Asc(e.KeyChar) <> 32 Then

Page | 247
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then

e.Handled = True

End If

End If

End Sub

Private Sub TxtReasonApplying_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles txtReasonApplying.KeyPress

'Allowed all

End Sub

Private Sub BtnCheck_Click(sender As Object, e As EventArgs) Handles btnCheck.Click

Try

Dim dbConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")
Dim dbDataReader As OleDbDataReader
Dim dbCommand As New OleDbCommand

btnNext.Text = "Change"
btnNext.BackColor = Color.Green

If dbConnection.State = ConnectionState.Open Then dbConnection.Close()

dbConnection.Open()
dbCommand.CommandText = "select
[StudentPicture],[StudentNumber],[GradeLevel],[Strand],[Semester],[Lastname],[Firstname
],[Middlename],[Age],[DOB],[Sex],[POB],[Nationality],[Religion],[Email],[MobileNumber],
[TelephoneNumber],[Address],[City],[FatherName],[FatherOccupation],[FatherEmail],[Fathe
rWorkAddress],[FatherContactNumber],[MotherName],[MotherOccupation],[MotherEmail],[Moth
erWorkAddress],[MotherContactNumber],[NumberOfSiblings],[PersonEmergency],[GuardianName
],[GuardianRelation],[GuardianEmail],[GuardianWorkAddress],[GuardianContactNumber],[Fet
cherName],[FetcherContactNumber],[SiblingsOfStudent1],[SiblingsOfStudent2],[SiblingsOfS
tudent3],[SiblingsOfStudentAge1],[SiblingsOfStudentAge2],[SiblingsOfStudentAge3],[Sibli
ngsOfStudentSchool1],[SiblingsOfStudentSchool2],[SiblingsOfStudentSchool3],[SchoolLastA
ttended1],[SchoolLastAttended2],[SchoolLastAttended3],[AcademicYear1],[AcademicYear2],[
AcademicYear3],[SchoolYear],[ReasonApplying] from EnrollmentData where StudentNumber =
'" & txtStudentNumber.Text & "'"
dbCommand.Connection = dbConnection
dbDataReader = dbCommand.ExecuteReader

If dbDataReader.Read Then

Dim x As Byte() = dbDataReader(0)


Dim ms As New MemoryStream(x)
StudentPic.Image = Image.FromStream(ms)
txtStudentNumber.Text = dbDataReader(1).ToString()
cmbGradeLevel.Text = dbDataReader(2).ToString()
cmbStrand.Text = dbDataReader(3).ToString()

Page | 248
cmbSemester.Text = dbDataReader(4).ToString()
txtLastname.Text = dbDataReader(5).ToString()
txtFirstname.Text = dbDataReader(6).ToString()
txtMiddlename.Text = dbDataReader(7).ToString()
txtAge.Text = dbDataReader(8).ToString()
dtpDOB.Value = dbDataReader(9).ToString()
If dbDataReader(10).ToString() = "Male" Then
rdoMale.Checked = True

ElseIf dbDataReader(10).ToString() = "Female" Then


rdoFemale.Checked = True

End If
txtPOB.Text = dbDataReader(11).ToString()
txtNationality.Text = dbDataReader(12).ToString()
txtReligion.Text = dbDataReader(13).ToString()
txtEmail.Text = dbDataReader(14).ToString()
txtMobileNo.Text = dbDataReader(15).ToString()
txtTelephoneNo.Text = dbDataReader(16).ToString()
txtStudentAddress1.Text = dbDataReader(17).ToString()
txtStudentAddress2.Text = dbDataReader(18).ToString()
txtFatherName.Text = dbDataReader(19).ToString()
txtFatherOccupation.Text = dbDataReader(20).ToString()
txtFatherEmail.Text = dbDataReader(21).ToString()
txtFatherWorkAddress.Text = dbDataReader(22).ToString()
txtFatherContactNo.Text = dbDataReader(23).ToString()
txtMotherName.Text = dbDataReader(24).ToString()
txtMotherOccupation.Text = dbDataReader(25).ToString()
txtMotherEmail.Text = dbDataReader(26).ToString()
txtMotherWorkAddress.Text = dbDataReader(27).ToString()
txtMotherContactNo.Text = dbDataReader(28).ToString()
txtNoOfSiblings.Text = dbDataReader(29).ToString()
If dbDataReader(30).ToString() = "Father" Then
rdoFather.Checked = True

ElseIf dbDataReader(30).ToString() = "Mother" Then


rdoMother.Checked = True

ElseIf dbDataReader(30).ToString() = "Others" Then


rdoOthers.Checked = True

End If
txtGuardianName.Text = dbDataReader(31).ToString()
txtGuardianRelation.Text = dbDataReader(32).ToString()
txtGuardianEmail.Text = dbDataReader(33).ToString()
txtGuardianWorkAddress.Text = dbDataReader(34).ToString()
txtGuardianContactNo.Text = dbDataReader(35).ToString()
txtFetcherName.Text = dbDataReader(36).ToString()
txtFetcherContactNo.Text = dbDataReader(37).ToString()
txtSiblingsofStudent1.Text = dbDataReader(38).ToString()
txtSiblingsofStudent2.Text = dbDataReader(39).ToString()
txtSiblingsofStudent3.Text = dbDataReader(40).ToString()
txtSiblingsAge1.Text = dbDataReader(41).ToString()
txtSiblingsAge2.Text = dbDataReader(42).ToString()
txtSiblingsAge3.Text = dbDataReader(43).ToString()
txtSiblingsSchool1.Text = dbDataReader(44).ToString()
txtSiblingsSchool2.Text = dbDataReader(45).ToString()
txtSiblingsSchool3.Text = dbDataReader(46).ToString()

Page | 249
txtSchoolLastAttended1.Text = dbDataReader(47).ToString()
txtSchoolLastAttended2.Text = dbDataReader(48).ToString()
txtSchoolLastAttended3.Text = dbDataReader(49).ToString()
txtAcademicYear1.Text = dbDataReader(50).ToString()
txtAcademicYear2.Text = dbDataReader(51).ToString()
txtAcademicYear3.Text = dbDataReader(52).ToString()
cmbSchoolYear.Text = dbDataReader(53).ToString()
txtReasonApplying.Text = dbDataReader(54).ToString()

cmbGradeLevel.Enabled = False
cmbStrand.Enabled = False
cmbSemester.Enabled = False
cmbSchoolYear.Enabled = False
txtLastname.Enabled = False
txtFirstname.Enabled = False
txtMiddlename.Enabled = False
txtAge.Enabled = False
dtpDOB.Enabled = False
rdoMale.Enabled = False
rdoFemale.Enabled = False
txtPOB.Enabled = False
txtNationality.Enabled = False
txtReligion.Enabled = False
txtMobileNo.Enabled = False
txtStudentAddress1.Enabled = False
txtStudentAddress2.Enabled = False
txtFatherName.Enabled = False
txtMotherName.Enabled = False
rdoFather.Enabled = False
rdoMother.Enabled = False
rdoOthers.Enabled = False
txtGuardianName.Enabled = False
txtGuardianContactNo.Enabled = False

cmbGradeLevel.BackColor = Color.White
cmbStrand.BackColor = Color.White
cmbSemester.BackColor = Color.White
cmbSchoolYear.BackColor = Color.White
txtLastname.BackColor = Color.White
txtFirstname.BackColor = Color.White
txtMiddlename.BackColor = Color.White
txtAge.BackColor = Color.White
dtpDOB.BackColor = Color.White
rdoMale.BackColor = Color.White
rdoFemale.BackColor = Color.White
txtPOB.BackColor = Color.White
txtNationality.BackColor = Color.White
txtReligion.BackColor = Color.White
txtMobileNo.BackColor = Color.White
txtStudentAddress1.BackColor = Color.White
txtStudentAddress2.BackColor = Color.White
txtFatherName.BackColor = Color.White
txtMotherName.BackColor = Color.White
rdoFather.BackColor = Color.White
rdoMother.BackColor = Color.White
rdoOthers.BackColor = Color.White
txtGuardianName.BackColor = Color.White
txtGuardianContactNo.BackColor = Color.White

Page | 250
End If

dbConnection.Close()

Return

Catch ex As Exception

MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error")


Exit Try

End Try

End Sub

Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles


PictureBox2.Click

StudentEnrollmentGuide.Show()

PictureBox2.Visible = False

End Sub

End Class

Page | 251
StudentEnrollmentGuide.vb
Imports System.ComponentModel

Public Class StudentEnrollmentGuide

Private Sub StudentEnrollmentGuide_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

End Sub

Private Sub StudentEnrollmentGuide_Closing(sender As Object, e As CancelEventArgs)


Handles Me.Closing

StudentEnrollment.PictureBox2.Visible = True

End Sub

End Class

Page | 252
StudentRegistered.vb
Public Class StudentRegistered

Private Sub RoundButton(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(btnProceed.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()
btnProceed.Region = New Region(Raduis)

End Sub

Private Sub StudentRegistered_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

RoundButton(btnProceed)

lblName.Text = StudentEnrollment.txtLastname.Text & ", " &


StudentEnrollment.txtFirstname.Text & " " & StudentEnrollment.txtMiddlename.Text
lblStatus.Text = "reserved"
lblReferenceNumber.Text = "yasc" & StudentEnrollment.txtEnrollmentNo.Text
lblDateExpire.Text =
(StudentEnrollment.dtbIdentify.Value).AddDays(14).ToString(" MMM / d / yyyy")
lblReferenceNumber2.Text = "'" & "yasc" &
StudentEnrollment.txtEnrollmentNo.Text & "'"

End Sub

Private Sub BtnProceed_Click(sender As Object, e As EventArgs) Handles


btnProceed.Click

Dim yesno As Integer = MessageBox.Show("Do you really want to close? ",


"Successfully Pre-enrolled", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

If yesno = MsgBoxResult.No Then


Return

Else
MsgBox("Thank you for choosing Young Achievers` School of Caloocan." &
vbNewLine & "Please do not share the student's unique reference number",
MsgBoxStyle.Information, "Successfully Pre-enrolled")
StudentEnrollment.Panel1.Visible = True
StudentEnrollment.PictureBox1.Visible = True

Page | 253
StudentEnrollment.Clear()
Hide()

End If

End Sub

End Class

Page | 254
StudentRequirements.vb
Imports System.Data.OleDb
Imports Word = Microsoft.Office.Interop.Word

Public Class StudentRequirements

Private Sub RoundButton(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(btnConfirm.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()

btnConfirm.Region = New Region(Raduis)

End Sub

Private Sub StudentRequirements_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

RoundButton(btnConfirm)

Dim readonly1 As Object = True


Dim visible As Object = True
Dim save As Object = True
Dim filename As Object = $"{My.Application.Info.DirectoryPath}\Data Privacy
Office.docx"
Dim missing As Object = Type.Missing
Dim template As Object = False
Dim typedoc As Object = 0

Dim doc1 As Word.Document = Nothing


Dim word1 As New Word.Application() With {
.Visible = False
}
doc1 = word1.Documents.Open(filename,
readonly1,
visible)
doc1.ActiveWindow.Selection.WholeStory()
doc1.ActiveWindow.Selection.Copy()
Dim data1 As IDataObject = Clipboard.GetDataObject
RichTextBox1.Rtf = data1.GetData(DataFormats.Rtf).ToString
word1.Quit(missing)

RichTextBox1.BackColor = Color.White

Page | 255
End Sub

Private Sub ChbConfirm_CheckedChanged(sender As Object, e As EventArgs) Handles


chbConfirm.CheckedChanged

If chbConfirm.Checked = True Then


btnConfirm.Enabled = True
btnConfirm.BackColor = Color.Green
btnConfirm.ForeColor = Color.White

ElseIf chbConfirm.Checked = False Then


btnConfirm.Enabled = False
btnConfirm.BackColor = Color.Gray
btnConfirm.ForeColor = Color.Black

End If

End Sub

Private Sub BtnConfirm_Click(sender As Object, e As EventArgs) Handles


btnConfirm.Click

Try
'deletion
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=@Sc
hoolYear,Lastname=@Lastname,Firstname=@Firstname,Middlename=@Middlename,Age=@Age,DOB=@D
OB,Sex=@Sex,POB=@POB,Nationality=@Nationality,Religion=@Religion,Email=@Email,MobileNum
ber=@MobileNumber,TelephoneNumber=@TelephoneNumber,Address=@Address,City=@City,FatherNa
me=@FName,FatherOccupation=@FOccupation,FatherEmail=@FEmail,FatherWorkAddress=@FWorkAdd
ress,FatherContactNumber=@FContactNumber,MotherName=@MName,MotherOccupation=@MOccupatio
n,MotherEmail=@MEmail,MotherWorkAddress=@MWorkAddress,MotherContactNumber=@MContactNumb
er,NumberOfSiblings=@NumOfSiblings,PersonEmergency=@PersonEmergency,GuardianName=@GName
,GuardianRelation=@GRelation,GuardianEmail=@GEmail,GuardianWorkAddress=@GWorkAddress,Gu
ardianContactNumber=@GContactNumber,FetcherName=@FetcherName,FetcherContactNumber=@Fetc
herContactNumber,SiblingsOfStudent1=@SiblingsOfStudent1,SiblingsOfStudent2=@SiblingsOfS
tudent2,SiblingsOfStudent3=@SiblingsOfStudent3,SiblingsOfStudentAge1=@SiblingsOfStudent
Age1,SiblingsOfStudentAge2=@SiblingsOfStudentAge2,SiblingsOfStudentAge3=@SiblingsOfStud
entAge3,SiblingsOfStudentSchool1=@SiblingsOfStudentSchool1,SiblingsOfStudentSchool2=@Si
blingsOfStudentSchool2,SiblingsOfStudentSchool3=@SiblingsOfStudentSchool3,SchoolLastAtt
ended1=@SchoolLastAttended1,SchoolLastAttended2=@SchoolLastAttended2,SchoolLastAttended
3=@SchoolLastAttended3,AcademicYear1=@AYear1,AcademicYear2=@AYear2,AcademicYear3=@AYear
3,ReasonApplying=@ReasonApplying,StudentPicture=@SPic Where (StudentNumber='" &
StudentEnrollment.txtStudentNumber.Text & "') ", ChangeConnection)

' Student Number


Dim StudentNumber As New OleDbParameter("@SNum", OleDbType.VarWChar, 25)
With {

Page | 256
.Value = StudentEnrollment.txtStudentNumber.Text.ToString()
}
ChangeCommand.Parameters.Add(StudentNumber)
'deletion

Dim ConditionConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If ConditionConnection.State = ConnectionState.Open Then


ConditionConnection.Close()
ConditionConnection.Open()
'StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High School"
Dim query As String = "INSERT INTO EnrollmentData
[Condition],[Requirement1],[Requirement2],[Requirement3],[Requirement4],[Status]
values(@d1,@d2,@d3,@d4,@d5,@d6) WHERE Identifier = '" &
StudentEnrollment.dtbIdentify.Text & "'"
Dim ConditionCommand As New OleDbCommand(query, ConditionConnection)

' Special Arrangements and Conditions


Dim Conditions As New OleDbParameter("@d1", OleDbType.VarWChar, 10)

If rdoCondition1.Checked Then
Conditions.Value = "1"
ConditionCommand.Parameters.Add(Conditions)
ElseIf rdoCondition2.Checked Then
Conditions.Value = "2"
ConditionCommand.Parameters.Add(Conditions)
ElseIf rdoCondition3.Checked Then
Conditions.Value = "3"
ConditionCommand.Parameters.Add(Conditions)
ElseIf rdoCondition4.Checked Then
Conditions.Value = "4"
ConditionCommand.Parameters.Add(Conditions)
ElseIf rdoCondition5.Checked Then
Conditions.Value = "5"
ConditionCommand.Parameters.Add(Conditions)
Else
Conditions.Value = "0"

End If

' Birth Certificate (Original) PSA Copy


Dim Requirement1 As New OleDbParameter("@d2", OleDbType.VarWChar, 10) With
{
.Value = chbRequirement1.Text.ToString()
}
ConditionCommand.Parameters.Add(Requirement1)

' Good Moral Certificate


Dim Requirement2 As New OleDbParameter("@d3", OleDbType.VarWChar, 10) With
{
.Value = chbRequirement2.Text.ToString()
}
ConditionCommand.Parameters.Add(Requirement2)

' SF10

Page | 257
Dim Requirement3 As New OleDbParameter("@d4", OleDbType.VarWChar, 10) With
{
.Value = chbRequirement3.Text.ToString()
}
ConditionCommand.Parameters.Add(Requirement3)

' 1 x 1 Picture
Dim Requirement4 As New OleDbParameter("@d5", OleDbType.VarWChar, 10) With
{
.Value = chbRequirement4.Text.ToString()
}
ConditionCommand.Parameters.Add(Requirement4)

' Status
Dim Status As New OleDbParameter("@d6", OleDbType.VarWChar, 10) With {
.Value = "reserved"
}
ConditionCommand.Parameters.Add(Status)

If (rdoCondition1.Checked = False And rdoCondition2.Checked = False And


rdoCondition3.Checked = False And rdoCondition4.Checked = False And
rdoCondition5.Checked = False) Then
MsgBox("Please fill the Special Arrangements and Conditions!",
MsgBoxStyle.Information, "Special Arrangements and Conditions Missing")
Return

Else
Dim okcancel As Integer = MessageBox.Show("I have read the conditions
stated herein and I have full understanding of my responsibilities and liabilities with
Young Achievers` School of Caloocan, Inc.. I agree with all of the legal constraints
and repercussions. Young Achievers` School of Caloocan, Inc. may hold against me should
I violate any of the above-mentioned conditions. I understand that I am in contract
with Young Achievers` School of Caloocan, Inc. and that I subject myself under its
implementing rules and regulations, and terms and conditions.", "Young Achievers School
of Caloocan", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)

If okcancel = vbCancel Then


Return

Else

Dispose()
StudentEnrollment.Registered()

End If

End If

Catch ex As Exception
MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error")
Exit Sub

End Try

End Sub

End Class

Page | 258
StudentSubject.vb
Imports System.Data.OleDb

Public Class StudentSubject


Private Sub BtnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click

StudentRequirements.Hide()
StudentRegistered.Hide()
StudentEnrollment.Panel1.Visible = True
StudentEnrollment.PictureBox1.Visible = True
Hide()

End Sub

Private Sub BtnNext_Click(sender As Object, e As EventArgs) Handles btnNext.Click

Hide()
StudentEnrollment.Requirements()

End Sub

Private Sub RoundButtonBack(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(btnBack.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()

btnBack.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)

Page | 259
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 ClassSchedule_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

RoundButtonBack(btnBack)
RoundButtonNext(btnNext)

lblName.Text = StudentEnrollment.txtLastname.Text & ", " &


StudentEnrollment.txtFirstname.Text & " " & StudentEnrollment.txtMiddlename.Text

If StudentEnrollment.cmbGradeLevel.Text = "Nursery - Pre-School" Then


lblGrade.Text = "Nursery"

'Kinder
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Kinder 1 - Pre-School" Then
lblGrade.Text = "Kinder 1"
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Kinder 2 - Pre-School" Then
lblGrade.Text = "Kinder 2"

'Elementary
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 1 - Elementary" Then
lblGrade.Text = "Grade 1"
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 2 - Elementary" Then
lblGrade.Text = "Grade 2"
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 3 - Elementary" Then
lblGrade.Text = "Grade 3"
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 4 - Elementary" Then
lblGrade.Text = "Grade 4"
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 5 - Elementary" Then
lblGrade.Text = "Grade 5"
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 6 - Elementary" Then
lblGrade.Text = "Grade 6"
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 7 - Junior High School"
Then
lblGrade.Text = "Grade 7"
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 8 - Junior High School"
Then
lblGrade.Text = "Grade 8"
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 9 - Junior High School"
Then
lblGrade.Text = "Grade 9"
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 10 - Junior High School"
Then
lblGrade.Text = "Grade 10"

'GRADE 11 Senior High School

Page | 260
ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "Academic - Accountancy, Business and Management
(ABM)") Then
lblGrade.Text = "Grade 11 - ABM"
ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "Academic - General Academic Strand (GAS)") Then
lblGrade.Text = "Grade 11 - GAS"
ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "Academic - Humanities and Social Sciences
(HUMSS)") Then
lblGrade.Text = "Grade 11 - HUMSS"
ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "Academic - Science, Technology, Engineering and
Mathematics (STEM)") Then
lblGrade.Text = "Grade 11 - STEM"
ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "TVL - Home Economics (HE)") Then
lblGrade.Text = "Grade 11 - HE"
ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "TVL - Information and Communications Technology
(ICT)") Then
lblGrade.Text = "Grade 11 - ICT"
ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "TVL Tracks - Industrial Arts (IA)") Then
lblGrade.Text = "Grade 11 - IA"

'GRADE 12 Senior High School


ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "Academic - Accountancy, Business and Management
(ABM)") Then
lblGrade.Text = "Grade 12 - ABM"
ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "Academic - General Academic Strand (GAS)") Then
lblGrade.Text = "Grade 12 - GAS"
ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "Academic - Humanities and Social Sciences
(HUMSS)") Then
lblGrade.Text = "Grade 12 - HUMSS"
ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "Academic - Science, Technology, Engineering and
Mathematics (STEM)") Then
lblGrade.Text = "Grade 12 - STEM"
ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "TVL - Home Economics (HE)") Then
lblGrade.Text = "Grade 12 - HE"
ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "TVL - Information and Communications Technology
(ICT)") Then
lblGrade.Text = "Grade 12 - ICT"
ElseIf (StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High School"
And StudentEnrollment.cmbStrand.Text = "TVL Tracks - Industrial Arts (IA)") Then
lblGrade.Text = "Grade 12 - IA"
End If

Try

Page | 261
Dim SubjectConnection As New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")
If SubjectConnection.State = ConnectionState.Open Then
SubjectConnection.Close()
SubjectConnection.Open()

'from EnrollmentData where StudentNumber = '" & txtStudentNumber.Text & "'"


If StudentEnrollment.cmbGradeLevel.Text = "Nursery - Pre-School" Then
Dim query As String = "SELECT NurseryCode,NurserySubject FROM Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()

ElseIf StudentEnrollment.cmbGradeLevel.Text = "Kinder 1 - Pre-School" Then


Dim query As String = "SELECT Kinder1Code,Kinder1Subject FROM Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Kinder 2 - Pre-School" Then
Dim query As String = "SELECT Kinder2Code,Kinder2Subject FROM Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {

Page | 262
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()

'Elementray
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 1 - Elementary" Then
Dim query As String = "SELECT Grade1Code,Grade1Subject FROM Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 2 - Elementary" Then
Dim query As String = "SELECT Grade2Code,Grade2Subject FROM Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With

Page | 263
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 3 - Elementary" Then
Dim query As String = "SELECT Grade3Code,Grade3Subject FROM Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 4 - Elementary" Then
Dim query As String = "SELECT Grade4Code,Grade4Subject FROM Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 5 - Elementary" Then
Dim query As String = "SELECT Grade5Code,Grade5Subject FROM Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand

Page | 264
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 6 - Elementary" Then
Dim query As String = "SELECT Grade6Code,Grade6Subject FROM Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 7 - Junior High
School" Then
Dim query As String = "SELECT Grade7Code,Grade7Subject FROM Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()

Page | 265
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 8 - Junior High
School" Then
Dim query As String = "SELECT Grade8Code,Grade8Subject FROM Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 9 - Junior High
School" Then
Dim query As String = "SELECT Grade9Code,Grade9Subject FROM Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 10 - Junior High
School" Then
Dim query As String = "SELECT Grade10Code,Grade10Subject FROM Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

Page | 266
If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()

'Grade 11
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "Academic - Accountancy, Business And
Management(ABM)" Then
Dim query As String = "SELECT Grade11ABMCode,Grade11ABMSubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "Academic - General Academic Strand
(GAS)" Then
Dim query As String = "SELECT Grade11GASCode,Grade11GASSubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With

Page | 267
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "Academic - Humanities And Social
Sciences (HUMSS)" Then
Dim query As String = "SELECT Grade11HUMSSCode,Grade11HUMSSSubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "Academic - Science, Technology,
Engineering And Mathematics(STEM)" Then
Dim query As String = "SELECT Grade11STEMCode,Grade11STEMSubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "TVL - Home Economics (HE)" Then

Page | 268
Dim query As String = "SELECT Grade11HECode,Grade11HESubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "TVL - Information And Communications
Technology (ICT)" Then
Dim query As String = "SELECT Grade11ICTCode,Grade11ICTSubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 11 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "TVL Tracks - Industrial Arts (IA)" Then
Dim query As String = "SELECT Grade11IACode,Grade11IASubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand

Page | 269
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
'Grade 12
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "Academic - Accountancy, Business And
Management(ABM)" Then
Dim query As String = "SELECT Grade12ABMCode,Grade12ABMSubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "Academic - General Academic Strand
(GAS)" Then
Dim query As String = "SELECT Grade12GASCode,Grade12GASSubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)

Page | 270
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "Academic - Humanities And Social
Sciences (HUMSS)" Then
Dim query As String = "SELECT Grade12HUMSSCode,Grade12HUMSSSubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "Academic - Science, Technology,
Engineering And Mathematics(STEM)" Then
Dim query As String = "SELECT Grade12STEMCode,Grade12STEMSubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "TVL - Home Economics (HE)" Then

Page | 271
Dim query As String = "SELECT Grade12HECode,Grade12HESubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "TVL - Information And Communications
Technology (ICT)" Then
Dim query As String = "SELECT Grade12ICTCode,Grade12ICTSubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
ElseIf StudentEnrollment.cmbGradeLevel.Text = "Grade 12 - Senior High
School" And StudentEnrollment.cmbStrand.Text = "TVL Tracks - Industrial Arts (IA)" Then
Dim query As String = "SELECT Grade12IACode,Grade12IASubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand

Page | 272
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()

Else
Dim query As String = "SELECT Grade11ICTCode,Grade11ICTSubject FROM
Subject"
Dim dbDataReader As OleDbDataReader
Dim dbDataAdapter As New OleDbDataAdapter
Dim dbCommand As New OleDbCommand With {
.CommandText = query,
.Connection = SubjectConnection
}
dbDataAdapter.SelectCommand = dbCommand
dbDataReader = dbCommand.ExecuteReader
ListView1.Items.Clear()

If dbDataReader.HasRows Then
While dbDataReader.Read()
With ListView1.Items.Add(dbDataReader(0).ToString)
.SubItems.Add(dbDataReader(1).ToString)
End With
End While
End If

dbCommand.Dispose()
dbDataReader.Close()
End If

Catch ex As Exception
MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error")
Exit Try

End Try

End Sub

End Class

Page | 273
TeacherData.vb
Imports System.Data.OleDb
Imports System.Drawing.Imaging
Imports System.IO
Imports System.Text

Public Class TeacherData

Sub Clear()

TeacherIDTextBox.Text = ""
PasswordTextBox.Text = ""
UsernameTextBox.Text = ""
DateOfBirthDateTimePicker.Value = Now
PlaceOfBirthTextBox.Text = ""
EmailIDTextBox.Text = ""
PictureID.Image = Image.FromFile(My.Application.Info.DirectoryPath &
"\Image\personal.png")

End Sub

Private Sub RoundButtonAdd(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(btnAdd.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()

btnAdd.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonClear(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)

Page | 274
Raduis.AddArc(New Rectangle(btn.Width - 20, 0, 20, 20), -90, 90)
Raduis.AddLine(btnClear.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()

btnClear.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonSave(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(btnSave.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()

btnSave.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonDelete(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(btnDelete.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()

btnDelete.Region = New Region(Raduis)

End Sub

Private Sub RoundButtonCapture(btn As Button)

Page | 275
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)

Page | 276
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 TeacherInfoBindingNavigatorSaveItem_Click(sender As Object, e As


EventArgs) Handles TeacherInfoBindingNavigatorSaveItem.Click

If MessageBox.Show("Do you want to countinue save?", "Question",


MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then

Validate()
TeacherInfoBindingSource.EndEdit()
TableAdapterManager.UpdateAll(Pre_enrollmentDataSet)

End If

MessageBox.Show("Save successful", "Record saved", MessageBoxButtons.OK,


MessageBoxIcon.Information)

End Sub

Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load

'TODO: This line of code loads data into the


'Pre_enrollmentDataSet.TeacherInfo' table. You can move, or remove it, as needed.
Me.TeacherInfoTableAdapter.Fill(Me.Pre_enrollmentDataSet.TeacherInfo)

RoundButtonAdd(btnAdd)
RoundButtonClear(btnClear)
RoundButtonSave(btnSave)
RoundButtonDelete(btnDelete)
RoundButtonCapture(btnCapture)
RoundButtonBrowse(btnBrowse)
RoundButtonRemove(btnRemove)

Try

txtSearchTeacherID.Text = " "


txtSearchTeacherID.Text = ""

Dim TeacherID As String = DataGridView1.CurrentRow.Cells(0).Value


TeacherIDTextBox.Text = TeacherID

Dim Password As String = DataGridView1.CurrentRow.Cells(1).Value


txtUncrypticPassword.Text = Decrypt(Password.ToString)

Dim Username As String = DataGridView1.CurrentRow.Cells(2).Value


UsernameTextBox.Text = Username

Dim DOB As String = DataGridView1.CurrentRow.Cells(3).Value


DateOfBirthDateTimePicker.Value = DOB

Page | 277
Dim POB As String = DataGridView1.CurrentRow.Cells(4).Value
PlaceOfBirthTextBox.Text = POB

Dim EmailID As String = DataGridView1.CurrentRow.Cells(5).Value


EmailIDTextBox.Text = EmailID

Dim PictureValue As Byte() = DataGridView1.CurrentRow.Cells(6).Value


Dim msPicture As New MemoryStream(PictureValue)
PictureID.Image = Image.FromStream(msPicture)

' Auto Completion Search TeacherID


Dim SearchTeacherIDConnection As New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")
If SearchTeacherIDConnection.State = ConnectionState.Open Then
SearchTeacherIDConnection.Close()
SearchTeacherIDConnection.Open()

Dim SearchTeacherIDCommand As New OleDbCommand("Select TeacherID from


TeacherInfo", SearchTeacherIDConnection)
Dim SearchTeacherIDDataAdapter As New
OleDbDataAdapter(SearchTeacherIDCommand)
Dim SearchTeacherIDDataSet As New DataSet
SearchTeacherIDDataAdapter.Fill(SearchTeacherIDDataSet)
Dim SearchTeacherIDColumn As New AutoCompleteStringCollection
Dim i As Integer
For i = 0 To SearchTeacherIDDataSet.Tables(0).Rows.Count - 1

SearchTeacherIDColumn.Add(SearchTeacherIDDataSet.Tables(0).Rows(i)("TeacherID").ToStrin
g())
Next
txtSearchTeacherID.AutoCompleteSource = AutoCompleteSource.CustomSource
txtSearchTeacherID.AutoCompleteCustomSource = SearchTeacherIDColumn
txtSearchTeacherID.AutoCompleteMode = AutoCompleteMode.SuggestAppend

' Auto Completion Search Username


Dim SearchUsernameConnection As New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")
If SearchUsernameConnection.State = ConnectionState.Open Then
SearchUsernameConnection.Close()
SearchUsernameConnection.Open()

Dim SearchUsernameCommand As New OleDbCommand("Select Username from


TeacherInfo", SearchUsernameConnection)
Dim SearchUsernameDataAdapter As New
OleDbDataAdapter(SearchUsernameCommand)
Dim SearchUsernameDataSet As New DataSet
SearchUsernameDataAdapter.Fill(SearchUsernameDataSet)
Dim SearchUsernameColumn As New AutoCompleteStringCollection
Dim j As Integer
For j = 0 To SearchUsernameDataSet.Tables(0).Rows.Count - 1

SearchUsernameColumn.Add(SearchUsernameDataSet.Tables(0).Rows(j)("Username").ToString()
)
Next
txtSearchUsername.AutoCompleteSource = AutoCompleteSource.CustomSource
txtSearchUsername.AutoCompleteCustomSource = SearchUsernameColumn

Page | 278
txtSearchUsername.AutoCompleteMode = AutoCompleteMode.SuggestAppend

Catch ex As Exception
Clear()
PictureID.Image = Image.FromFile(My.Application.Info.DirectoryPath &
"\Image\personal.png")
MessageBox.Show(ex.Message.ToString(), "Failed to Load Picture Id! (If
adding a new teacher its normal)")
Exit Sub

End Try

End Sub

Private Sub BtnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click

Clear()

End Sub
Private Sub BtnAddTeacher_Click(sender As Object, e As EventArgs) Handles
btnAdd.Click
Try
AddTeacher()

Me.TeacherInfoTableAdapter.Fill(Me.Pre_enrollmentDataSet.TeacherInfo)
txtSearchTeacherID.Text = "1"
txtSearchTeacherID.Text = ""

Catch ex As Exception

MessageBox.Show(ex.Message, "Error INSERT New Teacher",


MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub

End Try
End Sub

Sub AddTeacher()
Try

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


TeacherInfo([TeacherID],[Password],[Username],DateOfBirth,[PlaceOfBirth],[EmailID],Teac
herPic) values(@d1,@d2,@d3,@d4,@d5,@d6,@d7)"
Dim NextCommand As New OleDbCommand(NextString, NextConnection)

' Teacher ID
Dim TeacherID As New OleDbParameter("@d1", OleDbType.VarWChar, 30) With {
.Value = TeacherIDTextBox.Text.ToString().ToUpper
}
NextCommand.Parameters.Add(TeacherID)

Page | 279
' Password
Dim Password As New OleDbParameter("@d2", OleDbType.VarWChar, 30) With {
.Value = Encrypt(txtUncrypticPassword.Text.ToString())
}
NextCommand.Parameters.Add(Password)

' Username
Dim Username As New OleDbParameter("@d3", OleDbType.VarWChar, 30) With {
.Value = UsernameTextBox.Text.ToString()
}
NextCommand.Parameters.Add(Username)

' Date of Birth


Dim DOB As New OleDbParameter("@d4", OleDbType.Date, 15) With {
.Value = DateOfBirthDateTimePicker.Text.ToString()
}
NextCommand.Parameters.Add(DOB)

' Place of Birth


Dim PlaceOfBirth As New OleDbParameter("@d5", OleDbType.VarWChar, 30) With
{
.Value = PlaceOfBirthTextBox.Text.ToString()
}
NextCommand.Parameters.Add(PlaceOfBirth)

' EmailID
Dim EmailID As New OleDbParameter("@d6", OleDbType.VarWChar, 30) With {
.Value = EmailIDTextBox.Text.ToString()
}
NextCommand.Parameters.Add(EmailID)

Dim MemStream As New MemoryStream


Dim PictureID_Upload As Byte()

PictureID.Image.Save(MemStream, ImageFormat.Png)
PictureID_Upload = MemStream.GetBuffer()
MemStream.Read(PictureID_Upload, 0, MemStream.Length)

' Teacher ID Picture


Dim TeacherPicture As New OleDbParameter("@d7", SqlDbType.Image) With {
.Value = PictureID_Upload
}
NextCommand.Parameters.Add(TeacherPicture)

If NextCommand.ExecuteNonQuery() Then

NextConnection.Close()

Else

MsgBox("New Teacher 'INSERT' failed.", MsgBoxStyle.Critical, "Adding


new teacher failed")
Return

End If

Catch ex As Exception

Page | 280
MessageBox.Show(ex.Message, "Error 'INSERT' New Teacher",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub

End Try

End Sub

Sub SaveData()

Try

Dim UpdateConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If UpdateConnection.State = ConnectionState.Open Then


UpdateConnection.Close()
UpdateConnection.Open()

Dim TeacherCommand As New OleDbCommand("Update TeacherInfo Set


[Password]=@Password,[Username]=@Username,DateOfBirth=@DateOfBirth,[PlaceOfBirth]=@Plac
eOfBirth,[EmailID]=@EmailID,TeacherPic=@Pic Where (TeacherID='" & TeacherIDTextBox.Text
& "')", UpdateConnection)

' Password
Dim Password As New OleDbParameter("@Password", OleDbType.VarWChar, 50)
With {
.Value = Encrypt(txtUncrypticPassword.Text.ToString())
}
TeacherCommand.Parameters.Add(Password)

' Username
Dim Username As New OleDbParameter("@Username", OleDbType.VarWChar, 50)
With {
.Value = UsernameTextBox.Text.ToString()
}
TeacherCommand.Parameters.Add(Username)

' DateOfBirth
Dim DateOfBirth As New OleDbParameter("@DateOfBirth", OleDbType.Date, 50)
With {
.Value = DateOfBirthDateTimePicker.Text.ToString()
}
TeacherCommand.Parameters.Add(DateOfBirth)

' PlaceOfBirth
Dim PlaceOfBirth As New OleDbParameter("@PlaceOfBirth", OleDbType.VarWChar,
50) With {
.Value = PlaceOfBirthTextBox.Text.ToString()
}
TeacherCommand.Parameters.Add(PlaceOfBirth)

' EmailID
Dim EmailID As New OleDbParameter("@EmailID", OleDbType.VarWChar, 50) With
{
.Value = EmailIDTextBox.Text.ToString()

Page | 281
}
TeacherCommand.Parameters.Add(EmailID)

Dim TeacherMemStream As New MemoryStream


Dim TeacherDataPic_Update As Byte()

PictureID.Image.Save(TeacherMemStream, Imaging.ImageFormat.Png)
TeacherDataPic_Update = TeacherMemStream.GetBuffer()
TeacherMemStream.Read(TeacherDataPic_Update, 0, TeacherMemStream.Length)

' Teacher ID Picture


Dim TeacherPicture As New OleDbParameter("@Pic", SqlDbType.Image) With {
.Value = TeacherDataPic_Update
}
TeacherCommand.Parameters.Add(TeacherPicture)

If TeacherCommand.ExecuteNonQuery() Then
UpdateConnection.Close()
MsgBox("Your data updated successfully.", MsgBoxStyle.Information,
"Data Updated")

Else
MsgBox("Your data update failed.", MsgBoxStyle.Critical, "Update
Failed")
Return

End If

Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Saving data failed!")
Exit Sub

End Try

End Sub Private Sub BtnSave_Click(sender As Object, e As EventArgs) Handles


btnSave.Click

If txtUncrypticPassword.Text = "" Then


MessageBox.Show("Please enter a password", "Password empty",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub

Else
If MessageBox.Show("Do you want to countinue save?", "Question",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then

SaveData()
Me.TeacherInfoTableAdapter.Fill(Me.Pre_enrollmentDataSet.TeacherInfo)
txtSearchTeacherID.Text = "1"
txtSearchTeacherID.Text = ""
End If
End If

End Sub

Private Sub BtnDelete_Click(sender As Object, e As EventArgs) Handles


btnDelete.Click
Try

Page | 282
If TeacherIDTextBox.Text <> "" Then
If MsgBox("Are you sure to delete data with Teacher Id: " &
TeacherIDTextBox.Text & " ?", MsgBoxStyle.OkCancel, "Delete confirm") =
MsgBoxResult.Cancel Then
' do nothing
Else
Dim cn As New
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")
If cn.State = ConnectionState.Open Then cn.Close()
cn.Open()

Dim temp As Integer = 0


Dim query As String = "DELETE FROM TeacherInfo WHERE TeacherID ='"
& TeacherIDTextBox.Text & "'"

Dim cmd As New OleDbCommand(query) With {


.Connection = cn
}

temp = cmd.ExecuteNonQuery()
If temp > 0 Then
cn.Close()
'Call DataSetFill()
MessageBox.Show("Successfully deleted", "Record",
MessageBoxButtons.OK, MessageBoxIcon.Information)

Me.TeacherInfoTableAdapter.Fill(Me.Pre_enrollmentDataSet.TeacherInfo)
txtSearchTeacherID.Text = "1"
txtSearchTeacherID.Text = ""
Else
'Call DataSetFill()
MessageBox.Show("No record found", "Sorry",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End If

End If
Else
MsgBox("Fill Teacher Id on Id textbox which Teacher to delete!!",
MsgBoxStyle.OkOnly, "Info Data")
End If

Catch ex As Exception
MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error")
End Try

End Sub

Private Sub DataGridView1_CellClick(sender As Object, e As


DataGridViewCellEventArgs) Handles DataGridView1.CellClick

Try

Dim TeacherID As String = DataGridView1.CurrentRow.Cells(0).Value


TeacherIDTextBox.Text = TeacherID

Page | 283
Dim Password As String = DataGridView1.CurrentRow.Cells(1).Value
txtUncrypticPassword.Text = Decrypt(Password.ToString)

Dim Username As String = DataGridView1.CurrentRow.Cells(2).Value


UsernameTextBox.Text = Username

Dim DOB As String = DataGridView1.CurrentRow.Cells(3).Value


DateOfBirthDateTimePicker.Value = DOB

Dim POB As String = DataGridView1.CurrentRow.Cells(4).Value


PlaceOfBirthTextBox.Text = POB

Dim EmailID As String = DataGridView1.CurrentRow.Cells(5).Value


EmailIDTextBox.Text = EmailID

Dim PictureValue As Byte() = DataGridView1.CurrentRow.Cells(6).Value


Dim msPicture As New MemoryStream(PictureValue)
PictureID.Image = Image.FromStream(msPicture)

Catch ex As Exception
Clear()
DateOfBirthDateTimePicker.Value = Now
PictureID.Image = Image.FromFile(My.Application.Info.DirectoryPath &
"\Image\personal.png")
MessageBox.Show(ex.Message.ToString(), "Failed to Load Picture Id! (If
adding a new teacher its normal)")
Exit Sub

End Try

End Sub

Private Sub BtnCapture_Click(sender As Object, e As EventArgs) Handles


btnCapture.Click

cmbCapture.Text = "TeacherData"
CapturePicture.Show()

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 = "Select ID Picture:"
.Filter = "Image files:
(*.jpg)|*.jpg|(*.jpeg)|*.jpeg|(*.png)|*.png|(*.Gif)|*.Gif|(*.bmp)|*.bmp| All Files
(*.*)|*.*"
If .ShowDialog = Windows.Forms.DialogResult.OK Then
PictureID.Image = Image.FromFile(.FileName)
End If
End With
Catch ex As Exception

Page | 284
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

PictureID.Image = Image.FromFile(My.Application.Info.DirectoryPath &


"\Image\personal.png")

End Sub
Private Sub TxtSearchTeacherID_TextChanged(sender As Object, e As EventArgs)
Handles txtSearchTeacherID.TextChanged

Try

Dim SearchTeacherIDConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If SearchTeacherIDConnection.State = ConnectionState.Open Then


SearchTeacherIDConnection.Close()
SearchTeacherIDConnection.Open()

Dim SearchTeacherIDCommand As New OleDbCommand("SELECT * FROM TeacherInfo


WHERE TeacherID LIKE '%" & txtSearchTeacherID.Text & "%' AND Username LIKE '%" &
txtSearchUsername.Text & "%'", SearchTeacherIDConnection)
Dim SearchTeacherIDDataAdapter As New OleDbDataAdapter
Dim SearchTeacherIDDataTable As New DataTable

SearchTeacherIDDataAdapter.SelectCommand = SearchTeacherIDCommand
SearchTeacherIDDataTable.Clear()
SearchTeacherIDDataAdapter.Fill(SearchTeacherIDDataTable)
DataGridView1.DataSource = SearchTeacherIDDataTable
SearchTeacherIDConnection.Close()

If DataGridView1.CurrentRow Is Nothing Then

Clear()

ElseIf DataGridView1.CurrentRow IsNot DBNull.Value Then


Dim TeacherID As String = DataGridView1.CurrentRow.Cells(0).Value
TeacherIDTextBox.Text = TeacherID

Dim Password As String = DataGridView1.CurrentRow.Cells(1).Value


txtUncrypticPassword.Text = Decrypt(Password.ToString)

Dim Username As String = DataGridView1.CurrentRow.Cells(2).Value


UsernameTextBox.Text = Username

Dim DOB As String = DataGridView1.CurrentRow.Cells(3).Value


DateOfBirthDateTimePicker.Value = DOB

Dim POB As String = DataGridView1.CurrentRow.Cells(4).Value


PlaceOfBirthTextBox.Text = POB

Page | 285
Dim EmailID As String = DataGridView1.CurrentRow.Cells(5).Value
EmailIDTextBox.Text = EmailID

Dim PictureValue As Byte() = DataGridView1.CurrentRow.Cells(6).Value


Dim msPicture As New MemoryStream(PictureValue)
PictureID.Image = Image.FromStream(msPicture)

End If

Catch ex As Exception
MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error Search Teacher ID")
Exit Sub

End Try

End Sub

Private Sub TxtUsername_TextChanged(sender As Object, e As EventArgs) Handles


txtSearchUsername.TextChanged

Try

Dim SearchUsernameConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If SearchUsernameConnection.State = ConnectionState.Open Then


SearchUsernameConnection.Close()
SearchUsernameConnection.Open()

Dim SearchUsernameCommand As New OleDbCommand("SELECT * FROM TeacherInfo


WHERE Username LIKE '%" & txtSearchUsername.Text & "%' AND TeacherID LIKE '%" &
txtSearchTeacherID.Text & "%'", SearchUsernameConnection)
Dim SearchUsernameDataAdapter As New OleDbDataAdapter
Dim SearchUsernameDataTable As New DataTable

SearchUsernameDataAdapter.SelectCommand = SearchUsernameCommand
SearchUsernameDataTable.Clear()
SearchUsernameDataAdapter.Fill(SearchUsernameDataTable)
DataGridView1.DataSource = SearchUsernameDataTable
SearchUsernameConnection.Close()

If DataGridView1.CurrentRow Is Nothing Then

Clear()

ElseIf DataGridView1.CurrentRow IsNot DBNull.Value Then


Dim TeacherID As String = DataGridView1.CurrentRow.Cells(0).Value
TeacherIDTextBox.Text = TeacherID

Dim Password As String = DataGridView1.CurrentRow.Cells(1).Value


txtUncrypticPassword.Text = Decrypt(Password.ToString)

Dim Username As String = DataGridView1.CurrentRow.Cells(2).Value


UsernameTextBox.Text = Username

Dim DOB As String = DataGridView1.CurrentRow.Cells(3).Value

Page | 286
DateOfBirthDateTimePicker.Value = DOB

Dim POB As String = DataGridView1.CurrentRow.Cells(4).Value


PlaceOfBirthTextBox.Text = POB

Dim EmailID As String = DataGridView1.CurrentRow.Cells(5).Value


EmailIDTextBox.Text = EmailID

Dim PictureValue As Byte() = DataGridView1.CurrentRow.Cells(6).Value


Dim msPicture As New MemoryStream(PictureValue)
PictureID.Image = Image.FromStream(msPicture)

End If

Catch ex As Exception
MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error Search Username")
Exit Sub

End Try

End Sub

Private Sub TxtUncrypticPassword_TextChanged(sender As Object, e As EventArgs)


Handles txtUncrypticPassword.TextChanged

PasswordTextBox.Text = Encrypt(txtUncrypticPassword.Text)

End Sub

Private Sub PasswordTextBox_TextChanged(sender As Object, e As EventArgs) Handles


PasswordTextBox.TextChanged

txtUncrypticPassword.Text = Decrypt(PasswordTextBox.Text)

End Sub

'Encryption
Public Function Encrypt(Encryption As String) As String

Try

Dim encode As Byte() = New Byte(Encryption.Length - 1) {}


encode = Encoding.UTF8.GetBytes(Encryption)
Dim msg As String = Convert.ToBase64String(encode)
Return msg

Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Encrypting data failed!")

End Try

End Function

'Decryption
Public Function Decrypt(Decryption As String) As String

Try

Page | 287
Dim encodedtext As New UTF8Encoding
Dim decode As Decoder = encodedtext.GetDecoder
Dim code_byte As Byte() = Convert.FromBase64String(Decryption)
Dim charcount As Integer = decode.GetCharCount(code_byte, 0,
code_byte.Length)
Dim decode_char As Char() = New Char(charcount - 1) {}
decode.GetChars(code_byte, 0, code_byte.Length, decode_char, 0)
Dim decryptext As New String(decode_char)
Return decryptext

Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Decrypting data failed!")

End Try

End Function

Private Sub picHelp1_Click(sender As Object, e As EventArgs) Handles picHelp1.Click

TeacherDataGuide.Show()

picHelp1.Visible = False

End Sub

End Class

Page | 288
TeacherDataGuide.vb
Imports System.ComponentModel

Public Class TeacherDataGuide

Private Sub TeacherDataGuide_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

End Sub

Private Sub TeacherDataGuide_Closing(sender As Object, e As CancelEventArgs)


Handles Me.Closing

TeacherData.picHelp1.Visible = True

End Sub

End Class

Page | 289
UserInfo.vb
Imports System.Data.OleDb
Imports System.IO

Public Class UserInfo

Private Sub UserInfo_FormClosing(sender As Object, e As FormClosingEventArgs)


Handles Me.FormClosing

MainForm.Show()

End Sub

Private Sub LinkLabel2_LinkClicked(sender As Object, e As


LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked

Dim User As New ChangeInfo


Hide()
User.Show()

End Sub

Private Sub LinkLabel1_LinkClicked(sender As Object, e As


LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked

Hide()
ChangePassword.Show()

End Sub

Private Sub LinkLabel3_LinkClicked(sender As Object, e As


LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked

Hide()
GenarateID.Show()

End Sub

Private Sub UserInfo_Load(sender As Object, e As EventArgs) Handles MyBase.Load

Try

Dim dbConnection As New


OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\Database\Pre-enrollment.accdb")

If dbConnection.State = ConnectionState.Open Then dbConnection.Close()


dbConnection.Open()

Dim dbDataReader As OleDbDataReader


Dim dbCommand As New OleDbCommand

If LoginForm.cmbFormState.Text = "Admin" Then

Page | 290
dbCommand.CommandText = "select
[AdminID],[Username],[DateOfBirth],[PlaceOfBirth],[EmailID],[Status],[AdminPic] from
AdminInfo where AdminID = '" & LoginForm.txtAdminUsername.Text & "'"
dbCommand.Connection = dbConnection
dbDataReader = dbCommand.ExecuteReader

If dbDataReader.Read Then

Username.Text = dbDataReader(1).ToString()
Dim DOB As String = dbDataReader(2).ToString()
Dim SplitPart = DOB.Split(" "c)
Dim final As String = SplitPart(0).Trim
DateOfBirth.Text = (String.Format("{0}", final)).ToString
PlaceOfBirth.Text = dbDataReader(3).ToString()
EmailID.Text = LCase(dbDataReader(4)).ToString()
Status.Text = dbDataReader(5).ToString()
Dim LoadPic As Byte() = dbDataReader("AdminPic")
Dim Memory As New MemoryStream(LoadPic)
PicID.Image = Image.FromStream(Memory)

End If

dbConnection.Close()
dbDataReader.Close()

Return

End If

If LoginForm.cmbFormState.Text = "Teacher" Then

dbCommand.CommandText = "Select [TeacherID], [Username], [DateOfBirth],


[PlaceOfBirth], [EmailID], [TeacherPic] from TeacherInfo where TeacherID = '" &
LoginForm.txtTeacherUsername.Text & "'"
dbCommand.Connection = dbConnection
dbDataReader = dbCommand.ExecuteReader

If dbDataReader.Read Then

Username.Text = dbDataReader(1).ToString()
Dim DOB As String = dbDataReader(2).ToString()
Dim SplitPart = DOB.Split(" "c)
Dim final As String = SplitPart(0).Trim
DateOfBirth.Text = (String.Format("{0}", final)).ToString
PlaceOfBirth.Text = dbDataReader(3).ToString()
EmailID.Text = LCase(dbDataReader(4)).ToString()
Label5.Visible = False
Status.Visible = False
Dim LoadPic As Byte() = dbDataReader("TeacherPic")
Dim Memory As New MemoryStream(LoadPic)
PicID.Image = Image.FromStream(Memory)

End If

dbConnection.Close()
dbDataReader.Close()

Return

Page | 291
End If

Catch ex As Exception

MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error...")


Exit Try

End Try

End Sub

End Class

Reviewed by: Endorsed by:

Mr. Ranilio David Mr. Chrysler Panaguiton


Capstone Project Adviser Capstone Project Consultant

Date: Date:

Page | 292
Curriculum Vitae

Page | 293
Page | 294
Page | 295
Page | 296
Page | 297
Page | 298
Page | 299
Page | 300
Page | 301
Page | 302
Page | 303
Page | 304

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy