Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 161

Republic of the Philippines

Cagayan State University


www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

BARANGAY PROFILING SYSTEM


OF
BARANGAY SAN ESTEBAN, ALCALA, CAGAYAN

________________________________________

A Thesis Presented to the Faculty of the


College of Information and Computing Sciences
Cagayan State University, Carig Campus
Tuguegarao City, Cagayan

________________________________________

In Partial Fulfillment of the


Academic Requirements for the
Degree Bachelor of Science in Information Technology

By:

ASUNCION, LILIBETH G.
DAKILA, GAILLE SANDRA R.
VINARAO, JUNEYCO A.

JANUARY 2019
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

APPROVAL SHEET

In partial fulfilment of the academic requirements for the degree of Bachelor of Science
in Information Technology, this thesis entitled “BARANGAY PROFILING SYSTEM OF
BARANGAY SAN ESTEBAN, ALCALA, CAGAYAN ” has been prepared and submitted by
LILIBETH G. ASUNCION, GAILLE SANDRA R. DAKILA, and JUNEYCO A VINARAO
who here by recommended for Oral Examination.

RAY KIM M. BAYLON, MIT


Capstone Project Adviser

IVVONE Q. SEGURO, MIT


Co-Adviser

Approved by the tribunal on Oral Examination with grade of _________.

FRANCIS JOSEPH REYES


Panel Chair

ROVINA S. GUIYAB, MIT VINCE GILBERT CABASAG


Panel Member Panel Member

Accepted and approved in partial fulfilment of the requirements for the degree of
Bachelor of Science in Information Technology.

RODERICK M. MASIRAG, MIT


Program Coordinator, BSIT

GENERINO P. SIDDAYAO, DIT


College Dean
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Acknowledgement

The researcher and developer gratefully acknowledge the invaluable support and
assistance extended by the following persons for without them the study would not reach the
ladder of success.

To the parents that support, love and encourage us to study and finished this book.

To the department of College of Information and Computing Sciences of Cagayan State


University-Carig campus that gives us professor (Prof. Ray Kim M. Baylon, MIT) and Co-
Adviser (Prof. Ivonne Q. Seguro, MIT) who support and guide us to accomplished this.

And to the Barangay of San Esteban and to their barangay officials to be led by Captain
Francisco Verzola who accepted our proposal to be the sample area of our research and give
information and cooperation in the time of interviewing and gathering information.

To Mr. Christian Gregory Carag who made the new logo of the barangay.

To our friends and classmates who joined us while doing this project and give us support.

Above all, to our Almighty God for the grace and for giving the necessary wisdom and
intelligence, as well as the health which greatly helped in the accomplishment of this project.

- The Researchers  
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Dedication

This piece of work is truly dedicated to the following for their most valuable assistance in
the improvement of this project.

To our beloved school, Cagayan State University- Carig Campus.

To our relatives and families.

To our friends.

Above all, to our Almighty God who gave us strength for us to finish work, Despite of
the hardships and challenges of time.

-The Researchers
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

ABSTRACT

Thesis title: BARANGAY PROFILING OF BARANGAY SAN ESTEBAN, ALCALA,


CAGAYAN
Researchers: ASUNCION, LILIBETH G.
DAKILA, GAILLE SANDRA R.
VINARAO, JUNEYCO A.
Course: BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
Adviser: RAY KIM M. BAYLON, MIT
Year: 2019

The researcher developed the ”Barangay Profiling of Barangay San Esteban,


Alcala, Cagayan” it aimed to develop an computerize system that; (a) enables the
authorized user to store, search and edit the resident’s informations;(b) provide
informations of the barangay;(c) implement security to the computerized system.

The system development process was used as the system development model.
Interview, library research and the inter research were used in the data gathering
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

BARANGAY PROFILING SYSTEM


OF BARANGAY SAN ESTEBAN, ALCALA, CAGAYAN

1. INTRODUCTION
1.1 Project Context
The barangay is the most basic government unit in the Philippines. As a basic
political unit, is the primary planning and implementing unit of the government policies,
plants, programs, projects and activities in the community. It also serves as the forum for
an expression, crystallization and consideration of the views of the people and the
amicable settlement of disputes among its residents.
The Barangay San Esteban of Alcala, Cagayan is aware that computer is an
essential element to be more competitive nowadays. They do believe that
computerization will hasten the processing capabilities, gives correct and accurate
information and reports in quick manner.
However, the barangay profiling system is still done manually. They could not
comply with the latest trend in verifying, searching and checking each document
efficiently.
Barangay San Esteban, Alcala, Cagayan has more than 2,700 residents found in
the calendar year 2017-2018. Because of this number of population they have, their
barangay officials were encountering different problems when it comes in finding and
storing the records of their residents. The records of the residents in their barangay are
not also properly secured. The residents are also suffering because of this problem; the
files of information that they need to get in their barangay hall was getting delayed. And
best solution of this is to build and install a computerized barangay profiling system.
Computerized Barangay Profiling System is a software that allows the barangay
officials to clean with resident’s data on the computer; the names and information about
the residents that are needed in their barangay. This will help the barangay as well as the
workers and the residents of the said barangay. The system will be the census like system
of the barangay for all of the constituents and new people to live in the barangay. And
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

this will be effective in maintaining, securing, searching and storing of records of all the
residents which will benefits the workers for having an easy time on accessing files and
records they need.
This research was conducted to create and design a computerized barangay
profiling system. Specially the system does the following; minimize the time consumed
in updating the records, difficulty in rewriting their records, to have an electronic device
to be used instead of filing in cabinets to keep the forms and records, to prevent lost of
files, and inefficient in it. And to have an updated database of the barangay data and
upgrade its internal operation system for an effective delivery of basic services.
1.2 Purpose and Description

The researchers seek to solve and improve the existing manual records of the barangay
and missing records.

The system has its bar graph which contains the statistics of the residents and
automatically update every time you change the records.

1.3 Objectives

1.3.1 General Objective

By this Barangay profiling system:

 it can help them to do their work more efficiently and lessen their time to
spent on doing the manual report system which assures the safety of their
files/records of the barangay
 It gives specific and complete records.

1.3.2 Specific Objectives

1. To avoid time and effort consuming, resulting into a number of work accomplish.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

2. To have an easy and faster preparation of the residents profile without going to
traditional way of searching an residents information.

1.4 Scope and Limitation

The computerized barangay profiling system focused in the information of residents of


barangay San Esteban, Alcala, Cagayan. The records of residents such as fullname, birthdate,
birthplace, age, religion, status etc.

This profiling system of the said barangay will make permanent, accurate and
systematic in gathering information. Effective in maintaining, securing, searching and
storing of records of all the residents.

1.5 Significance of the Study

Computerized Barangay Profiling System is a proposed system for barangay San Esteban
that will help the officials to handle records of the residents in an orderly way. Thus, the
study will benefit the following:

Barangay Officials- it will help them to manage resident’s records.

Residents of the Barangay- knowledge of studying will assure them that their records are
kept well and organized.

Researchers-result of the study will develop their skills in developing a system and
programming in particular.

Future Researchers- result of the study will give them an idea how to create such a system.

1.6 Definition of Terms


Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

These terminologies were gathered by the researcher for better and understanding about
the study.

Archives. In which the deleted records will stored.

Computer. Machine capable of the following the instruction to alter data, programmable
electronic device that can perform calculations and processing information.

Computer System. To equip the user from electronic computer facilitate or automated
procedures it is an easy to produce printed output or data.

Database. Is a container to store your tables.

Data. Is a collection of an unauthorized facts of figures.

Delete. To remove or erase.

Edit. To change something, usually for the better.

Information. Knowledge given or received of some fact or circumstances.

Input. Refers to information that given to a computer that acts on information to a computer.

Output. Refers to the information to the convention for transmitting data between a computer
and its peripherals.

Password. A secret combination of characters, a user must type into the computer in order to
start a program or open a file.

Process. Refers to a series of instructions that a computer executes in a multitasking or


operation system.

Profiling. It is a set of techniques or estimating the amount of time spent in various portions of
your program.

Profiling System. It is a unique personality assessment that encompasses a system of profiling


both people and process.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Program. An algorithm that can computer can both follow directly and follow the translated
version.

Records. It is a collection of related fields with information that usually pertains to only one
subject.

System. It is a group of interrelated components working together toward common goal by


accepting input and producing output in an organized transformation process.

Software. It is a system utility or application program expressed in complete readable language.

User. The person who uses a computer for word processing, communication and other
application.

User Friendly. A program easy to use even though an individual is not knowledgeable about the
system.

Visual Basic Net. Scripting language or programming language this is used to design the system.

2. REVIEW OF RELATED SYSTEMS

This chapter presents related literature and studies that serves as the basis in completion
of the study.

Intano (1999) Cantilan, Surigao del Sur is needed an information of barangay residents
and as a result she recommended that a school-based information system be established in one of
the colleges’ library near the area. As several researchers studied the Library Information
Science literature, they found that there were identified uses for information needs. Close to the
research in the Barangay setting.

Steven Alter,” Profiling System, a management perspective, 2nd edition,


Benjamin/Cummings Publishing Company, Inc.,1996. According to him, information technology
is hardware and software that make information system possible. An information system is a
system uses information technology to capture, transmit, store, retrieved, manipulate or display
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

information used in one or ore business process. It, means that information technology has a
business significant only when it is used as a part of an information system that supporting some
part of a business process. “Competing through information technology” it means that
“competing through business process that make especially effective use of information system
that involved in information technology”.

(Global Knowledge Partnership, 2000), information is the most important factor in


production and creation. Nowadays, people must have adequate knowledge to earn their living
and have suitable development. They can use their knowledge to individual or any organizations
to share their information will ultimately decide their ability to generate economic growth and to
enhance the quality of life. The rate of progress of community and the fulfillment of certain
needs of its people will determined by the effectiveness with which information is generated and
communicated.

Peterson and Alexander (2001:15) pointed out that results from needs assessments “can
offer useful information for a wide range of reorganizational considerations, including
organizational placement of programs with an agency and service delivery approaches”. Though
this demonstrates a broad application and diversity of use for community information needs
assessment data, community information profile assessments have particularly important
implications in community service delivery. This is also useful in “ provide useful information
on information use patterns as well as the overall importance of information problems and above
all the potential to complement efforts of government and international organizations “(World
Bank,2008). Reviews the changes taking place in the library and information profession globally,
as a result of the social and political changes taking place, considers the degree to which the
profession is considering its role as an agent of positive change. It is further argued that the
provision of information in this context should be aimed at communities with the central idea
that the public library and potential venues could provide community information which is
relevant and supportive of the what is needed in a community information which is relevant and
supportive of the what is needed in a community information service.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Soriano (2012) in his book Conducting a Needs Assessment: A Multidisciplinary


Approach, 2nd edition, is a concise, yet informative collection of information that gives the reader
a general understanding of needs assessments and its importance in program implementation.
Soriano states that information gathered from a needs assessment is used to make decisions on
how allocation of program resources and services should be made. The parties conducting the
assessment must thoroughly understand every aspect of the organization, stakeholders,
objectives, goals, reason for assessment and people involved in the assessment. This broad
approach is outlined so that it maybe applied to various organizations. This book goes into detail
about different, data gathering methods such as focus groups, key informants, interviews, and
forecasting. It also details how this method can be of use in different service organization, what
kind of results should be expected, and the strengths and weaknesses of each method. At the end
of this section exercises are provided so that the reader may apply what has been learned. This
book is an Introductory overview with preliminary steps in conducting needs assessments;
however, it is very broad and would need to be followed up using other reference materials in
order to truly understand and even remotely consider conducting a need assessment.

Pade-Khene et.al (2010:272) explained that “information needs can be elicited from
what is said; and from there, it should be possible to understand the kind of information that
would want to share”. The information needs can be further categorized and analyzed to provides
a general macro-level view, supplemented with macro—level analysis during the planning stage
to facilitate the understanding of how information program and centers may be used to support
the local needs.

Pade-Khene et.al (2010). Moreover, Pade, Mallinson and Sewry (2006) elucidated that
as the community interacts with the technology, a local demand driven needs analysis should be
carried out to pinpoint emerging information needs in the community, so as to promote the
sustainability of the programs in the long term Buchanan and Gibb (2007) identifying
information needs is “central to the effective organizational management of information”.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Murder et.al (2008) suggested that rich insights can be gained for understanding a
community through eliciting what they value and challenges in the community that they are more
familiar with, rather that focusing on the potential of innovation and technology.

A Practical Guide to Needs Assesment, by Kavita Gupta and Heekap Lee (2007) initially
discussed historic foundation data gathering methods, for need assessment approaches and a
toolkit that could be use by the reader in the assessment. The four needs assessment approaches
denote that there are different types of needs that lead to the different results. Identifying the
objective of the needs assessments is critical and Gupta has outlined the factors that should be
presented to distinguish what assessment the reader should use. She further explains that the
strategic assessment focuses in business strategy and performance evaluation. Competency base
assessments are needed to find what leads to excelling performers. The job and task analysis
identifiers what essential tasks are needed to create a training plan. Lastly, training needs
assessments are done to gaps in current training.

3. TECHNICAL BACKGROUND
 Overview of the current technologies (hardware/software/network) used in the current
system
 Discussions on the current trends and technologies to be used in developing and
implementing the proposed system
o Hardware
 Personal Computer/Laptop
 Printer
o Software
 Vb.net
 Access
 Photoshop
o Peopleware
 Administrator – Owner of the organization.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

 Residents and Officials – user of the system.

 How the project work?


o The project works as a client-server-based system. The server side allows full
access of the system where an administrator manages all the major functions of
the system. The official side will be used for the registration of the users to login.
In user interface has a limited access to the system.

4. METHODOLOGY

4.1 Requirements Analysis


A requirement analysis is a written document that contains a detailed information about
a complete evaluation of requirements that is needed for a specific field or subject. It is
actually a two-step process involving an initial survey of the current system and then an
analysis of the user’s needs. The output of this phase will documented in the next section.

4.2 Requirements Documentation


4.2.1 User Requirements

o The system should be able to add, edit, delete, and print records records.
o The system should be able to have a single admin and multiple user.
o The system should be able to search and viewed the records that needed.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

4.2.2 Functional Requirements

Flowchart

The user should create an account before Logging-in the system to make a records.
When they successfully log-in to the system, they can viewed the records they want
according to the main form which consist of Set-up, transaction, reports ad about the
system. They can also add, edit, delete and print records/list. When the user log-out
the system will go back to the log-in form.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Context Level Diagram

The resident comes to provides all necessary information of him/her, upon the providing

these information, those information go through a process where it is an barangay profiling

system and further produces the output or the feedback of the resident and finally produce

a report.

Data Flow Diagram (DFD)


Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

The resident provide information; those information will deliver to the sub process.

Once the resident give his her information it will go in the verify resident information

process. When there’s a new resident, it is required to provide his/her detail information.

That information will go to the verification process and will proceed to the next step which is

the process of register information resident and will immediately store the details of the new

resident in the list of residents. From there, it will generate the report. In establishing a

business in the barangay, the owner needs to provide his/her information; that information

will go to the verification process and check the owner in the list of residents. After that the

business will be registered. When the business registered it will issue the business permit to

the owner of the business.

Functions (Provide the requirements of each function. What each module or function
must do? Enumerate all functions and describe each.)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Add – The admin can add a record of the residents to the user interface.
Edit – The admin can edit the names, age and other information etc.. of the residents
of the barangay.
Archive – The admin can delete and restored the records of the residents of the
barangay.
Search – The admin can search the different information of the barangay.
Print – The admin can print records of the barangay.

4.2.3 Data Requirements


Entities Attributes Type Example
Security Resident ID Integer 1
Full Name String Vinarao Juneyco A.
User Name String Admin123
Password String Admin123
Account Type String Administration
Short Question String What is your
Short Question Account String nickname?
Admin123

Residents Resident ID Integer 1


Last Name String Vinarao
First Name String Juneyco
Middle Initial String Atienza
Zone String Zone 1
Sex String Male
Birth of Date Date/Time 10/23/1998
Age Integer 20
Civil Status String Single
Religion String Catholic
Nationality String Filipino
Educational Attainment String College Graduate
Occupation String Manager
Employment String Public
Person w/ Disability String No
Pantawid Pamilya Foundation String Yes
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Officials Resident ID Integer 1


Full Name String Vinarao Juneyco A.
Position String Sk. Chairman
Committee String Sport Development
Head of Zone Integer 1
Date Term Integer 2016-2019
Status String Active

Projects ID Integer 1
Zone String Zone 1
Project Type String Road
Funded By String Vinarao, Juneyco A.
Name of Donor String Vinarao Juneyco A.
Budget Integer 1,000,000
Date Started Date/Time 10/10/2019
Date Finish Date/Time 10/10/2020
Status String Proposal

Dead Notes ID Integer 1


Full Name String Lampa, Desa A.
Date of Birth Date/Time 01/02/1940
Age Integer 79
Date of Death Date/Time 01/02/2019
Zone String Zone 1

Migrated ID Integer 1
Person Full Name String Vinarao, Juneyco A.
Zone String Zone 1
Sex String Male
Date of Birth Date/Time 10/23/1998
Age Integer 20
Civil Status String Single
Date Migrated Date/Time 10/17/2018

Residents Resident ID Integer 1


Archive Last Name String Vinarao
First Name String Juneyco
Middle Initial String Atienza
Zone String Zone 1
Sex String Male
Birth of Date Date/Time 10/23/1998
Age Integer 20
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Civil Status String Single


Religion String Catholic
Nationality String Filipino
Educational Attainment String College Graduate
Occupation String Manager
Employment String Public
Person w/ Disability String No
Pantawid Pamilya Foundation String Yes

Archive Resident ID Integer 1


Officials Full Name String Vinarao Juneyco A.
Position String Sk. Chairman
Committee String Sport Development
Head of Zone Integer 1
Date Term Integer 2016-2019
Status String Active

Archive ID Integer 1
Projects Zone String Zone 1
Project Type String Road
Funded By String Vinarao, Juneyco A.
Name of Donor String Vinarao Juneyco A.
Budget Integer 1,000,000
Date Started Date/Time 10/10/2019
Date Finish Date/Time 10/10/2020
Status String Finish

Household House Number Integer 1


Zone String Zone 1
House String Owned
Lot String Owned
Water Style String Nawasa
Number of family Integer 2
Electric String W/ Electric
Water Sealled String W/Water Seal
Made House String Concrete
Auto Vehicle String No
Business String Sari-Sari Store
Pets String No
Family OFW String Yes
Farms String Yes
Resident ID Integer 41
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Head Name String Marabut,Vincent S.


Sex String Male
Date Of Birth Date/Time 10/04/1998
Age Integer 20
Civil Status String Single
Religion String Born Again
Nationality String Filipino
Education String College Graduate
Occupation String None
Employment String None

Occupation Occupations String Tricycle Driver

Person with PWD String Blind Person


Disabilities

Religion Religions String Catholic

Employment Employments String Private

Distribution of Group Of Ages String 1-4


Population Both Sexes Integer 1
According to Male Integer 1
Age and Sex Percent Double 4.55
Female Integer 0
Percent Double 0.00

Distribution of Educational Attainment String College Level


Population Both Sexes Integer 3
According to Male Integer 2
Educational Percent Double 9.09
Attainment and Female Integer 1
Sex Percent Double 4.55

Distribution of Group of Age String 15-19


Population Both Sexes Integer 7
According to Male Integer 2
Age and Sex Percent Double 9.09
Female Integer 5
Percent Double 22.73

System Log Logger String Admin123


Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Activity String System Log-In


Activity Date Date/Time 1/17/2019
Activity Time Date/Time 08:13:47 PM

Barangay ID AutoNumbe 1
Clearance Full Name r Vinarao,Juneyco A.
Zone String Zone 6
Purpose String School Purpose
Date of Birth String 09/08/1998
Age Date/Time 20
Secretary Number Gaille Sandra R. Dakila
Captain String Hon. Lilibeth Asuncion
Year String 2018
Date Number 20
Day String Thursday
String

Business ID AutoNumbe 2
Permit Full Name r Vinarao, Juneyco A.
Name of Business String Sari-Sari Store
Issued Name String Vinarao, Juneyco A.
Issued Day String 08
Issued Month String June
Issued Year String 2018
Captain Name Number Hon. Lilibeth Asuncion
Short Text
Indigence ID AutoNumbe 3
Full Name r Vinarao, Juneyco A.
Day Issued String 13
Month String June
Year String 2019
Captain Name Number Hon. Lilibeth Asuncion
String

4.3 Design of Software/Systems/Product/Processes


4.3.1 Data Description
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Explain how the information domain of your system is transformed into data
structures. Describe how the major data or system entities are stored, processed and
organized. List the database(s) or data storage items. For a small system, there is
normally only one database. It consists of all the tables.

4.3.2 Data Dictionary


Table Fields Data Type Null Remarks
Security Resident_ID AutoNumber No Primary Key
FName Short Text No
UName Short Text No
Pword Short Text No
AccType Short Text No
SQ Short Text No
SQA Short Text No

Residents ResidentID AutoNumber No Primary Key


rLN Short Text No
rFN Short Text No
rMN Short Text No
rSex Short Text No
rDOB Date/Time No
rAge Number No
rCstatus Short Text No
rReligion Short Text No
rNationality Short Text No
rEducation Short Text No
rOccupation Short Text No
rEmployment Short Text No
PWD Short Text No
PPF Short Text No

Officials ResidentID Auto Number No Primary Key


FName Short Text No
aPosition Short Text No
aDateServed Short Text No
acommittee Short Text No
HeadofZone Short Text No

Projects ID AutoNumber No Primary key


Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Zone Short Text No


ProjectType Short Text No
FundedBy Short Text No
NameofDonor Short Text No
Budget Short Text No
DateStarted Date/Time No
DateFinish Date/Time No
Status Short Text No

DeadNotes ID AutoNumber No Primary Key


FullName Short Text No
BirthDate Date/Time No
Age Number No
dateOfDeath Date/Time No
Zone Short Text No

Migrated ResidentID AutoNumber No Primary Key


Fullname Short Text No
rZone Short Text No
rSex Short Text No
rDOB Date/Time No
rAge Number No
rCstatus Short Text No
DateMigrated Date/Time No

Residents Archive ResidentID Number No


rLN Short Text No
rFN Short Text No
rMN Short Text No
rSex Short Text No
rDOB Date/Time No
rAge Number No
rCstatus Short Text No
rReligion Short Text No
rNationality Short Text No
rEducation Short Text No
rOccupation Short Text No
rEmployment Short Text No
PWD Short Text No
PPF Short Text No

Officials Archive ResidentID Number No


Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

FName Short Text No


aPosition Short Text No
aDateServed Short Text No
acommittee Short Text No
HeadofZone Short Text No

4.3.3 Entity Relationship Diagram (ERD)

Entity Relationship Diagram has two main Entities. Employee and DTR. The
Employee entity includes a more detailed set of attributes or fields such as Employee
Code, Last Name, First Name, Middle Name, Position, and Picture. The DTR entity
includes Employee Code, Am in, Am out, Pm in, Pm out, DTR Date, and Remarks.
The relationship is one to one because an instance of an employee timing in or out is
considered as one transaction. The cardinality for the relationship is both mandatory
because one transaction is a valid instance at the time an employee time in and out.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

4.3.4 Hierarchical Diagram


Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

4.3.5 User Interface Design (using wireframes)


Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Figure 1: Log-out message box

Figure 1: Archive message box

4.4 Development and Testing (where applicable)


The purpose of the Development Phase is to convert the system design prototyped in the
Design Phase into a working information system that addresses all documented system
requirements. Testing is done during the development and after the system development.
The actual system (screen shots) will be presented and discussed in chapter 5.

5. RESULTS AND DISCUSSION


a.The Proposed System
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Figure 5.1.1: Sign-up form

The (sign up) allows the admin and other users to create their account for them viewed
the records. In creating an account, the admin and other users must fill out the needed
information such as fullname, username, password, confirm password, account type,
security question and answer.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Figure 5.1.2: Log-in form

The (login page) shows a username and password windows that allows the admin
and user to open their records.

Figure 5.1.3: Main Form


Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

The (main form) consist of Set-up, transaction, Reports and About System.
Figure 5.1.4: Add form

The (Add form) show the needed information of a resident.


Figure 5.1.5: Edit Form
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

The (Edit form) show the different information of a resident where you can change and
update if needed.
Figure 5.1.6: Archive Form

The (archive form) shows the deleted record. The deleted records will stored here
like the records of barangay officials, residents etc.
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Figure 5.1.7: Activity Log Form

The (activity log form) show the previous activities you did like: deleting records,
adding records.

5. RECOMMENDATIONS

1. Training maybe conducted to barangay captain, officials and the secretary of the
barangay for them to familiarize on how to use and manage the developed system.
2. The administrators should be knowledgeable in programming for managing and
maintaining the system.
3. For future researchers who will conduct similar study may expand the scope to
include the video map in locating a resident’s house and for information..

APPENDICES

A. Source Code

’for unlock the system


Imports System.Data.OleDb
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Public Class AdminUnlock


Dim UName As String = ""
Dim Pword As String = ""
Private Sub AdminUnlock_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call konneksyon()
End Sub
Protected Overrides ReadOnly Property CreateParams() As
System.Windows.Forms.CreateParams
'to disable the alt+f4
Get
Dim cp As CreateParams = MyBase.CreateParams
Const CS_NOCLOSE As Integer = &H200
cp.ClassStyle = cp.ClassStyle Or CS_NOCLOSE
Return cp
End Get
End Property

Function UnlockSystem()

If Trim(txtUName.Text) <> "" And Trim(txtPword.Text) <> "" Then

sql = "select * from tblSecurity where UName='" & txtUName.Text &


"' and Pword='" & txtPword.Text & "'"
da = New OleDbDataAdapter(sql, kon)
ds = New DataSet
da.Fill(ds, "Security")
If ds.Tables("Security").Rows.Count <> 0 Then
UName = ds.Tables("Security").Rows(0).Item("UName").ToString
Pword = ds.Tables("Security").Rows(0).Item("Pword").ToString
End If
If txtUName.Text.Equals(UName) And txtPword.Text.Equals(Pword)
Then
sql = "delete * from LockTime"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()

Call frmlogin.CheckSystemLock()
Call Log()
MsgBox("System unlock successful!", MsgBoxStyle.Information,
"System Message")
txtUName.Clear()
txtPword.Clear()
Me.Close()
Else
MsgBox("Invalid Username/Password", MsgBoxStyle.Information,
"System Message")
End If
Else
MsgBox("Empty Username/Password field not allowed",
MsgBoxStyle.Information, "System Message")
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End If
Return True
End Function

Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String

act = "System unlock. Administrator account: " & txtUName.Text

sql = "insert into tblSystemLog values('" & txtUName.Text & "','" &
act & "','" & currDate & "','" & currTime & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
Return True
End Function

Private Sub btnUnlock_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnUnlock.Click
Call UnlockSystem()

End Sub

Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnCancel.Click
Me.Close()
End Sub

Private Sub lblUName_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles lblUName.Click
txtUName.Focus()
End Sub

Private Sub lblPword_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles lblPword.Click
txtPword.Focus()
End Sub

Private Sub txtUName_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txtUName.TextChanged
If txtUName.Text.Length <> 0 Then
lblUName.Visible = False
Else
lblUName.Visible = True
End If
End Sub

Private Sub txtPword_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txtPword.TextChanged
If txtPword.Text.Length <> 0 Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

lblPword.Visible = False
Else
lblPword.Visible = True
End If
End Sub

Private Sub txtUName_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtUName.KeyPress
If Asc(e.KeyChar) = 13 Then
txtPword.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtPword_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtPword.KeyPress
If Asc(e.KeyChar) = 13 Then
btnUnlock.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Label3.Click

End Sub
Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

End Sub
Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GroupBox2.Enter
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label1.Click

End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label2.Click

End Sub
Private Sub CMSAdminUnlock_Opening(ByVal sender As System.Object, ByVal e
As System.ComponentModel.CancelEventArgs) Handles CMSAdminUnlock.Opening

End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GroupBox1.Enter

End Sub
End Class
for add an account on security
Imports System.Data.OleDb

Public Class frmaeacounts

Private Sub frmaeacounts_Activated(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.Activated

End Sub

Private Sub AEUsers_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
Call konneksyon()
Call FillComboBox()
Call PwordStrength()
Call Pwordmatch()
End Sub

Protected Overrides ReadOnly Property CreateParams() As


System.Windows.Forms.CreateParams
'to disable the alt+f4
Get
Dim cp As CreateParams = MyBase.CreateParams
Const CS_NOCLOSE As Integer = &H200
cp.ClassStyle = cp.ClassStyle Or CS_NOCLOSE
Return cp
End Get
End Property

Function clear()
txtFName.Clear()
txtUName.Clear()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txtPword.Clear()
txtPwordMatch.Clear()
cboAccType.Text = ""
cboSQ.Text = ""
txtSQA.Clear()
Return True
End Function

Function FillComboBox()
cboAccType.Items.Clear()
cboAccType.Items.Add("Administrator")
cboAccType.Items.Add("User")

cboSQ.Items.Clear()
cboSQ.Items.Add("What is your nickname?")
cboSQ.Items.Add("What is your favorite food?")
cboSQ.Items.Add("What is your favorite book?")
cboSQ.Items.Add("What is your favorite color?")
cboSQ.Items.Add("What is the name of your pet?")
Return True
End Function

Function save()
If Trim(txtResientID.Text) <> "" And Trim(txtFName.Text) <> "" And
Trim(txtUName.Text) <> "" And Trim(txtPword.Text) <> "" And
Trim(txtPwordMatch.Text) <> "" And Trim(cboAccType.Text) <> "" And
Trim(cboSQ.Text) <> "" And Trim(txtSQA.Text) <> "" Then
If Trim(txtUName.Text.Length) >= 8 Then
If Trim(txtPword.Text.Length) >= 8 Then
If Trim(txtSQA.Text.Length) >= 8 Then
If lblPwordMatch.Text = "Passwords matched" Then
If AEswitch = "a" Then
sql = "insert into tblSecurity values('" &
txtResientID.Text & "','" & txtFName.Text & "','" & txtUName.Text & "','" &
txtPword.Text & "','" & cboAccType.Text & "','" & cboSQ.Text & "','" &
txtSQA.Text & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
Call frmUserAccount.FillDataGrid()
MsgBox("Record successfully saved.",
MsgBoxStyle.Information, "System Message")
Call AddLog()
AEswitch = ""
Me.Close()
Else
sql = "update tblSecurity set ResidentID='" &
txtResientID.Text & "',FName='" & txtFName.Text & "',UName='" & txtUName.Text
& "',Pword='" & txtPword.Text & "',AccType='" & cboAccType.Text & "',SQ='" &
cboSQ.Text & "',SQA='" & txtSQA.Text & "' where UName='" &
frmUserAccount.txtSelectedCode.Text & "'"
cmd = New OleDbCommand(sql, kon)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

cmd.ExecuteNonQuery()
If frmMain.Label23.Text =
frmUserAccount.txtSelectedCode.Text Then
frmMain.Label23.Text = txtUName.Text
frmMain.lblaccess.Text = cboAccType.Text
End If
Call frmUserAccount.FillDataGrid()
frmMain.lblaccess.Text = cboAccType.Text

MsgBox("Record successfully updated.",


MsgBoxStyle.Information, "System Message")
Call EditLog()
AEswitch = ""
Me.Close()
End If
Else
MsgBox("Unable to save. Passwords did not match",
MsgBoxStyle.Information, "System Message")
End If
Else
MsgBox("Security Answer too short. Password must be
minimum of 8 characters.", MsgBoxStyle.Information, "System Message")
txtSQA.Clear()
txtSQA.Focus()
End If
Else
MsgBox("Password too short. Password must be minimum of 8
characters.", MsgBoxStyle.Information, "System Message")
txtPword.Clear()
txtPwordMatch.Clear()
txtPword.Focus()
End If
Else
MsgBox("Username too short. Username must be minimum of 8
characters.", MsgBoxStyle.Information, "System Message")
txtUName.Clear()
txtUName.Focus()
End If
Else
MsgBox("Unable to save. Empty entries not allowed",
MsgBoxStyle.Information, "System Message")
End If
Return True
End Function

Function Pwordmatch()
If Trim(txtPword.Text) <> "" And Trim(txtPwordMatch.Text) <> "" Then
If Trim(txtPwordMatch.Text) = Trim(txtPword.Text) Then
lblPwordMatch.Text = "Passwords matched"
lblPwordMatch.ForeColor = Color.Green
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Else
lblPwordMatch.Text = "Passwords do not match"
lblPwordMatch.ForeColor = Color.Red
End If
Else
lblPwordMatch.Text = ""
End If
Return True
End Function

Function PwordStrength()
If txtPword.Text.Length > 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
Dim numDigits As Integer = 0
Dim numAlpha As Integer = 0
Dim x As Integer
Dim s As String = Trim(txtPword.Text)
For x = 0 To s.Length - 1
If Char.IsNumber(s(x)) Then
numDigits = numDigits + 1
End If
If Char.IsLetter(s(x)) Then
numAlpha = numAlpha + 1
End If
Next
If numDigits > 4 And numAlpha > 4 Then
lblPwordStrength.Text = "Strong"
lblPwordStrength.ForeColor = Color.Green
ElseIf numDigits > 2 And numAlpha > 2 Then
lblPwordStrength.Text = "Moderate"
lblPwordStrength.ForeColor = Color.Orange
ElseIf numDigits > 2 And numAlpha = 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
ElseIf numDigits = 0 And numAlpha > 2 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
End If
Else
lblPwordStrength.Text = ""
End If
Return True
End Function

Function AddLog()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

act = "Added new system user account. Username: " & txtUName.Text

sql = "insert into tblSystemLog values('" & frmMain.Label23.Text &


"','" & act & "','" & currDate & "','" & currTime & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
Return True
End Function

Function EditLog()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String

act = "Edited system user account.Username: " &


frmUserAccount.txtSelectedCode.Text & " to " & txtUName.Text

sql = "insert into SystemLog values('" & frmMain.lblaccess.Text &


"','" & act & "','" & currDate & "','" & currTime & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
Return True
End Function

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSave.Click
If cboAccType.Text = "User" Then
executeSQLStatement("select * from tblSecurity where AccType='" &
Trim(frmUserAccount.dgUsers.CurrentRow.Cells(4).Value.ToString) & "'")
If frmUserAccount.dgUsers.Rows.Count > 19 Then
MsgBox("Sorry The User Account is Already full!",
MsgBoxStyle.Critical, "System Message")
Else
save()
End If
ElseIf cboAccType.Text = "Administrator" Then
executeSQLStatement("select * from tblSecurity where AccType='" &
Trim(frmUserAccount.dgUsers.CurrentRow.Cells(4).Value.ToString) & "'")
If frmUserAccount.dgUsers.Rows.Count > 1 Then
MsgBox("There are only 1 Admins allowed!",
MsgBoxStyle.Critical, "System Message")
Else

save()
End If
End If

End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCancel.Click
AEswitch = ""
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Me.Close()
End Sub

Private Sub txtUName_LostFocus(ByVal sender As Object, ByVal e As


System.EventArgs) Handles txtUName.LostFocus
If AEswitch = "a" Then
sql = "select * from tblSecurity where UName='" & txtUName.Text &
"'"
da = New OleDbDataAdapter(sql, kon)
ds = New DataSet
da.Fill(ds, "Security")
If ds.Tables("Security").Rows.Count <> 0 Then
MsgBox("Username already exist, please change",
MsgBoxStyle.Information, "System Message")
txtUName.Clear()
txtUName.Focus()
Exit Sub
End If
Else
sql = "select * from tblSecurity where UName='" & txtUName.Text &
"'"
da = New OleDbDataAdapter(sql, kon)
ds = New DataSet
da.Fill(ds, "Security")
If ds.Tables("Security").Rows.Count <> 0 And txtUName.Text <>
frmUserAccount.txtSelectedCode.Text Then
MsgBox("Username already exist, please change",
MsgBoxStyle.Information, "System Message")
txtUName.Text = frmUserAccount.txtSelectedCode.Text
txtUName.Focus()
Exit Sub
End If
End If
End Sub

Private Sub txtPword_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txtPword.TextChanged
Call PwordStrength()
Call Pwordmatch()
End Sub

Private Sub txtPwordMatch_TextChanged(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles txtPwordMatch.TextChanged
Call Pwordmatch()
End Sub

Private Sub chkShowChar_CheckedChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles chkShowChar.CheckedChanged
If chkShowChar.CheckState = CheckState.Checked Then
txtSQA.UseSystemPasswordChar = False
Else
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txtSQA.UseSystemPasswordChar = True
End If
End Sub

Private Sub txtFName_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtFName.KeyPress
If Asc(e.KeyChar) = 13 Then
txtUName.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtUName_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtUName.KeyPress
If Asc(e.KeyChar) = 13 Then
txtPword.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtPword_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtPword.KeyPress
If Asc(e.KeyChar) = 13 Then
txtPwordMatch.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtPwordMatch_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtPwordMatch.KeyPress
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

If Asc(e.KeyChar) = 13 Then
cboAccType.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub cboAccType_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles cboAccType.KeyPress
If Asc(e.KeyChar) = 13 Then
cboSQ.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String = ""
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub cboSQ_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles cboSQ.KeyPress
If Asc(e.KeyChar) = 13 Then
txtSQA.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String = ""
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtSQA_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtSQA.KeyPress
If Asc(e.KeyChar) = 13 Then
chkShowChar.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

e.Handled = True
End If
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim frm As New frmseach23
frm.Text = "Select Person"
frmseach23.ShowDialog()
End Sub
End Class

“ for add dead person

Imports System.Data.OleDb
Public Class frmAEdeadnotes
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet

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


btnBrowse.Click
Dim frm As New FrmSearchRecord1
frm.Text = "Select Dead Person"
frm.ShowDialog()
End Sub

Sub save()
If Trim(Me.Text) = "Add Dead Person" Then
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tbldeadnotes([FullName],
[BirthDate],[Age],[dateofDeath],[Zone]) values ('" & txtfullname.Text & "','"
& txtdateofbirth.Text & "'," & txtage.Text & ",'" & DateTimePicker1.Text &
"','" & txtzone.Text & "')"
kom.ExecuteNonQuery()
kom.CommandText = "Delete * from tblresidents where ResidentID=" &
txtid.Text
kom.ExecuteNonQuery()
Call frmRecord.pupulate()
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
Log()
Me.Close()
Else
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "update [tbldeadnotes] set [FullName]='" &
txtfullname.Text & "', [BirthDate]='" & txtdateofbirth.Text & "', [Age]=" &
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txtage.Text & ", [dateofDeath]='" & DateTimePicker1.Text & "', [Zone]='" &
txtzone.Text & "' Where [ID]=" & txtsel.Text
kom.ExecuteNonQuery()
MsgBox("Record Updated!", MsgBoxStyle.Information, "Saved")
Log1()
Me.Close()
End If
End Sub
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Dead Person: " + txtfullname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Added Dead Person: " + txtfullname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Private Sub btnsave_Click(sender As Object, e As EventArgs) Handles
btnsave.Click
save()

End Sub

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


btncancel.Click
Me.Hide()
End Sub

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


MyBase.Load
Call konneksyon()
End Sub
End Class
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

“ for add officals

Imports System.Data.OleDb
Public Class frmAEofficials
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles
btnSave.Click
saveRecord()
End Sub
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = " Added Officials: " + cmbPostion.Text + ": " + txtlname.Text +
" " + txtfname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Official: " + cmbPostion.Text + ": " + txtlname.Text +
" " + txtfname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Sub saveRecord()
'trapping
Dim a As String
a = "Active"
If txtresidentID.Text = "" Or cmbPostion.Text = "" Or cmbTerm.Text =
"" Or cmbDateStart.Text = "" Or cmdateEnd.Text = "" Then
MsgBox("Cannot save. Required field missing!",
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Empty fields")
Exit Sub
End If
If Trim(Me.Text) = "Add Officials" Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

If Trim(cmbPostion.Text) = "Brgy. Secretary" Or


Trim(cmbPostion.Text) = "Brgy. Captain" Or Trim(cmbPostion.Text) = "Brgy.
Treasurer" Or Trim(cmbPostion.Text) = "Brgy. SK Chairman" Then
Call LoadRecord(da, dset, "[tblOfficials]", "Select * from
[tblOfficials] where [Position] = '" & Trim(cmbPostion.Text) & "'")

If (dset.Tables(0).Rows.Count <> 0) Then


MsgBox("Cannot have more than 1 official in this
position!", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Warning")
Exit Sub

End If

End If
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblOfficials([ResidentID],
[Position],[Term],[DateStart],[DateEnd],[Status]) values (" &
txtresidentID.Text & ",'" & cmbPostion.Text & "','" & cmbTerm.Text & "','" &
cmbDateStart.Text & "','" & cmdateEnd.Text & "','" & a & "')"
kom.ExecuteNonQuery()
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
Log()
clear()
Me.Close()

Else

kom = New OleDbCommand


kom.Connection = kon
kom.CommandText = "update [tblOfficials] set [ResidentID]=" &
txtresidentID.Text & ", [Position]='" & cmbPostion.Text & "', [Term]='" &
cmbTerm.Text & "', [DateStart]='" & cmbDateStart.Text & "', [DateEnd]='" &
cmdateEnd.Text & "'Where [OfficialsID]=" & txtID.Text
kom.ExecuteNonQuery()
MsgBox("Record Updated!", MsgBoxStyle.Information, "Saved")
Log1()
Me.Close()
clear()
End If
End Sub
Sub clear()
txtfname.Text = ""
txtfnmae.Text = ""
txtGender.Text = ""
txtID.Text = ""
txtlname.Text = ""
txtmidname.Text = ""
txtmname.Text = ""
txtname.Text = ""
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txtresidentID.Text = ""
txtzone.Text = ""
End Sub

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


MyBase.Load
cmbPostion.Items.Clear()
cmbPostion.Items.Add("Brgy. Captain")
cmbPostion.Items.Add("Brgy. Kagawad")
cmbPostion.Items.Add("Brgy. Secretary")
cmbPostion.Items.Add("Brgy. Treasurer")
cmbPostion.Items.Add("Brgy. Auditor")
cmbPostion.Items.Add("Brgy. SK Chairman")
cmbPostion.Items.Add("Brgy. SK Kagawad")
End Sub

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


btnbrowse.Click
Dim frm As New FrmSearchRecord1
frm.Text = "Select Officials"
frm.ShowDialog()
End Sub

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


btncancel.Click
Me.Close()
End Sub
End Class
“for add projects
Imports System.Data.OleDb
Public Class frmAEprojects
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet
Private Sub btnsave_Click(sender As Object, e As EventArgs) Handles
btnsave.Click
saveRecord()
End Sub
Sub clear()
txtbud.Text = ""
txtdonor.Text = ""
txtfun.Text = ""
txtpro.Text = ""
cmbzone.Text = ""
End Sub
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

act = " Added Project: " + txtpro.Text


kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Project: " + txtpro.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Sub saveRecord()
'trapping
If cmbzone.Text = "" Or txtpro.Text = "" Or txtfun.Text = "" Or
txtdonor.Text = "" Or txtbud.Text = "" Or txtdates.Text = "" Or txtdatef.Text
= "" Then
MsgBox("Cannot save. Required field missing!",
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Empty fields")
Exit Sub
End If
'ADD
If Trim(Me.Text) = "Add Project" Then
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblProject([Zone],[ProjectType],
[FundedBy],[NameOfDonor],[Budget],[DateStarted],[DateFinish],[Status]) values
('" & cmbzone.Text & "','" & txtpro.Text & "','" & txtfun.Text & "','" &
txtdonor.Text & "'," & txtbud.Text & ",'" & txtdates.Text & "','" &
txtdatef.Text & "','" & txtstat.Text & "')"
kom.ExecuteNonQuery()
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
Log()
Me.Close()
Else
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "update [tblProject] set [Zone]='" &
cmbzone.Text & "', [ProjectType]='" & txtpro.Text & "', [FundedBy]='" &
txtfun.Text & "', [NameOfDonor]='" & txtdonor.Text & "', [Budget]=" &
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txtbud.Text & ",[DateStarted]='" & txtdates.Text & "',[DateFinish]='" &


txtdatef.Text & "',[Status]='" & txtstat.Text & "' Where [ID]=" & txtsel.Text
kom.ExecuteNonQuery()
MsgBox("Record Updated!", MsgBoxStyle.Information, "Saved")
Log1()
Me.Close()
End If
End Sub

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


Handles txtbud.KeyPress
If Asc(e.KeyChar) = 13 Then
txtbud.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String = "0123456789. "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub
Private Sub frmAEprojects_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
cmbzone.Items.Clear()
cmbzone.Items.Add("Zone 1")
cmbzone.Items.Add("Zone 2")
cmbzone.Items.Add("Zone 3")
cmbzone.Items.Add("Zone 4")
cmbzone.Items.Add("Zone 5")
cmbzone.Items.Add("Zone 6")
cmbzone.Items.Add("Zone 7")
End Sub

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


txtbud.TextChanged

End Sub

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


txtdonor.TextChanged

End Sub

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


Handles txtdonor.KeyPress
If Asc(e.KeyChar) = 13 Then
txtdonor.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

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


txtfun.TextChanged

End Sub

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


Handles txtfun.KeyPress
If Asc(e.KeyChar) = 13 Then
txtfun.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

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


txtstat.TextChanged

End Sub

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


Handles txtstat.KeyPress
If Asc(e.KeyChar) = 13 Then
txtstat.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

End Class
“for add residents
Imports System.Data.OleDb
Public Class frmAEresidents
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Dim dset As New DataSet


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

End Sub
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = " Added Resident: " + txtLname.Text + ": " + txtFName.Text + " "
+ txtMname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Resident: " + txtLname.Text + ": " + txtFName.Text + "
" + txtMname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Sub clear()

txtage.Text = ""
txteduca.Text = ""
txtemplo.Text = ""
txtFName.Text = ""
txtID.Text = ""
txtLname.Text = ""
txtMname.Text = ""
txtnationality.Text = ""
txtoccu.Text = ""
cmbcivil.Text = ""
cmbdate.Text = ""
cmbsex.Text = ""
cmbzone.Text = ""
cmreligion.Text = ""
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End Sub
Sub saveRecord()
If txtLname.Text = "" Or txtFName.Text = "" Or txtMname.Text = "" Or
cmbsex.Text = "" Or cmbcivil.Text = "" Or txtage.Text = "" Or cmbzone.Text =
"" Or cmbsex.Text = "" Or cmreligion.Text = "" Or txtoccu.Text = "" Or
txteduca.Text = "" Then
MsgBox("Cannot save. Required field missing!",
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Empty fields")
Exit Sub
End If

If Me.Text = "Add Residents" Then


kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into
tblResidents(rLN,rFN,rMN,rZone,rSex,rDOB,rAge,rCstatus,rReligion,rNationality,
rEducatt,roccuption,rEmployment,PWD,PPF) values ('" & txtLname.Text & "','" &
txtFName.Text & "','" & txtMname.Text & "','" & cmbzone.Text & "','" &
cmbsex.Text & "','" & cmbdate.Text & "'," & txtage.Text & ",'" & cmbcivil.Text
& "','" & cmreligion.Text & "','" & txtnationality.Text & "','" &
txteduca.Text & "','" & txtoccu.Text & "','" & txtemplo.Text & "','" &
cmpwd.Text & "','" & cmb4ps.Text & "')"
kom.ExecuteNonQuery()
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
Log()
clear()
Me.Close()
Else
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "update tblResidents set rLN='" & txtLname.Text
& "', rFN='" & txtFName.Text & "', rMN='" & txtMname.Text & "', rZone='" &
cmbzone.Text & "', rSex='" & cmbsex.Text & "', rDOB='" & cmbdate.Text & "',
rAge='" & txtage.Text & "', rCstatus='" & cmbcivil.Text & "', rReligion='" &
cmreligion.Text & "', rNationality='" & txtnationality.Text & "', rEducatt='"
& txteduca.Text & "', roccuption='" & txtoccu.Text & "', PWD='" & cmpwd.Text &
"', PPF='" & cmb4ps.Text & "' where ResidentID=" & txtID.Text & ""
kom.ExecuteNonQuery()
MsgBox("Record Updated!", MsgBoxStyle.Information, "Saved")
Log1()
clear()
Me.Close()
End If
End Sub

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


cmbdate.ValueChanged
If cmbdate.Text = "" Then
Exit Sub
End If
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)


Dim dobdate As Integer = Val(Format(CDate(cmbdate.Text), "dd"))
Dim datenow As Integer = Val(Format(Now, "dd"))
Dim x As Integer = DateDiff(DateInterval.Year, CDate(cmbdate.Text),
CDate(currDate))
If Month(currDate) < Month(cmbdate.Text) Then
txtage.Text = x - 1
ElseIf Month(currDate) = Month(cmbdate.Text) And Year(currDate) >
Year(cmbdate.Text) Then
txtage.Text = x
If dobdate < datenow Then
txtage.Text = x - 1

End If
Else

txtage.Text = x

End If

End Sub
Private Sub frmAEresidents_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
FillComboBoxes("SELECT DISTINCT (rLN) from tblResidents", cmreligion,
"rLN")
'fillreligion()
fillcivilStatus()
fillzone()
fillgender()
educatt()
End Sub
Function fillreligion()
cmreligion.Items.Clear()
cmreligion.Items.Add("Catholic")
cmreligion.Items.Add("Jehova Witnesses")
cmreligion.Items.Add("Dating Daan")
cmreligion.Items.Add("Born Again")
cmreligion.Items.Add("Dating Daan")
cmreligion.Items.Add("Penticost")
cmreligion.Items.Add("Methodist")
cmreligion.Items.Add("Islam")
Return True
End Function
Function fillgender()
cmbsex.Items.Clear()
cmbsex.Items.Add("Male")
cmbsex.Items.Add("Female")
Return True
End Function
Function fillzone()
cmbzone.Items.Clear()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

cmbzone.Items.Add("Zone 1")
cmbzone.Items.Add("Zone 2")
cmbzone.Items.Add("Zone 3")
cmbzone.Items.Add("Zone 4")
cmbzone.Items.Add("Zone 5")
cmbzone.Items.Add("Zone 6")
cmbzone.Items.Add("Zone 7")
Return True
End Function
Function fillcivilStatus()
cmbcivil.Items.Clear()
cmbcivil.Items.Add("SINGLE")
cmbcivil.Items.Add("MARRIED")
cmbcivil.Items.Add("SEPERATED")
cmbcivil.Items.Add("WIDOWED")
Return True
End Function
Function educatt()
txteduca.Items.Clear()
txteduca.Items.Add("NONE")
txteduca.Items.Add("PRE-SCHOOL")
txteduca.Items.Add("ELEMENTARY LEVEL")
txteduca.Items.Add("HIGH SCHOOL LEVEL")
txteduca.Items.Add("VOCATIONAL")
txteduca.Items.Add("COLLEGE LEVEL")
txteduca.Items.Add("COLLEGE GRADUATE")
txteduca.Items.Add("POST BACCALAUREATE")
Return True
End Function
Private Sub txtLname_KeyPress(sender As Object, e As KeyPressEventArgs)
Handles txtLname.KeyPress
If Asc(e.KeyChar) = 13 Then
txtLname.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub
Private Sub txtFName_KeyPress(sender As Object, e As KeyPressEventArgs)
Handles txtFName.KeyPress
If Asc(e.KeyChar) = 13 Then
txtFName.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

e.Handled = True
End If
End If
End Sub

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


Handles txtMname.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMname.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtnationality_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles txtnationality.KeyPress
If Asc(e.KeyChar) = 13 Then
txtnationality.Focus()
txtoccu.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

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


txtFName.TextChanged

End Sub

Private Sub cmbsex_SelectedIndexChanged(sender As Object, e As EventArgs)


Handles cmbsex.SelectedIndexChanged

End Sub

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


txtemplo.TextChanged
If txtemplo.Text = "NONE" Then
txtoccu.Text = "NONE"
Else
txtoccu.Text = ""
End If
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End Sub

Private Sub cmreligion_SelectedIndexChanged(sender As Object, e As


EventArgs) Handles cmreligion.SelectedIndexChanged

End Sub
End Class

“For data archives


Imports System.Data.OleDb
Public Class frmArchives
Dim dt As New OleDbDataAdapter
Dim dtset As DataSet
Dim kom As New OleDbCommand
Dim dgFont As New Font("Cambria", 10)
Sub pupulate()
Select Case Trim(Me.Text)
Case "Residents"
'Call konneksyon()
lblarchives.Text = "Resident Archive"
Call LoadRecord(dt, dtset, "tblResidentArchive", "Select *
from tblResidentArchive", DataGridView1)
lblcount.Text = dtset.Tables("tblResidentArchive").Rows.Count
& "Records found!"
formatgrid()
Case "Officials"
'Call konneksyon()
lblarchives.Text = "Official Archive"
Call LoadRecord(dt, dtset, "tblOfficialsArchive", "Select *
from tblOfficialsArchive", DataGridView1)
lblcount.Text = dtset.Tables("tblOfficialsArchive").Rows.Count
& "Records found!"
formatgrid()
Case "Household"
lblarchives.Text = "HouseHold Archive"
Call LoadRecord(dt, dtset, "tblhHarchive", "Select * from
tblhHarchive", DataGridView1)
lblcount.Text = dtset.Tables("tblhHarchive").Rows.Count &
"Records found!"
frmHouseholds.formatdgv()
'formatgrid()
Case "Projects"
lblarchives.Text = "Projects Archives"
Call LoadRecord(dt, dtset, "tblProjectArchive", "Select * from
tblProjectArchive", DataGridView1)
lblcount.Text = dtset.Tables("tblProjectArchive").Rows.Count &
"Records found!"
formatdgv()
End Select
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End Sub
Private Sub frmArchives_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
Call konneksyon()
Call pupulate()
End Sub
Sub formatdgv()
With DataGridView1
.Font = dgFont
.Columns(0).HeaderText = "House No"
.Columns(0).Width = 120
.Columns(1).HeaderText = "Zone"
.Columns(1).Width = 120
.Columns(2).HeaderText = "T-House"
.Columns(2).Width = 120
.Columns(3).HeaderText = "T-Lot"
.Columns(3).Width = 120
.Columns(4).HeaderText = "Water Resources"
.Columns(4).Width = 200
.Columns(5).HeaderText = "Number of Family"
.Columns(5).Width = 250
.Columns(6).HeaderText = "Electric"
.Columns(6).Width = 120
.Columns(7).HeaderText = "Water Sealed"
.Columns(7).Width = 250
.Columns(8).HeaderText = "House Made-Up"
.Columns(8).Width = 230
.Columns(9).HeaderText = "Auto Vehicle"
.Columns(9).Width = 120
.Columns(10).HeaderText = "Business"
.Columns(10).Width = 120
.Columns(11).HeaderText = "Pets"
.Columns(11).Width = 220
.Columns(12).HeaderText = "Family OFW"
.Columns(12).Width = 220
.Columns(13).HeaderText = "Farms"
.Columns(13).Width = 120
.Columns(14).HeaderText = "Family OFW"
.Columns(14).Width = 220
.Columns(15).Visible = False
.Columns(16).HeaderText = "Head Name"
.Columns(16).Width = 220
.Columns(17).HeaderText = "Sex"
.Columns(17).Width = 120
.Columns(18).HeaderText = "Date of Birth"
.Columns(18).Width = 200
.Columns(19).HeaderText = "Age"
.Columns(19).Width = 120
.Columns(20).HeaderText = "Civil Status"
.Columns(20).Width = 120
.Columns(21).HeaderText = "Religion"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

.Columns(21).Width = 120
.Columns(22).HeaderText = "Nationality"
.Columns(22).Width = 120
.Columns(23).HeaderText = "Occupation"
.Columns(23).Width = 120
.Columns(24).HeaderText = "Employement"
.Columns(24).Width = 120
End With
End Sub

Sub formatgrid()
Select Case Trim(Me.Text)
Case "Residents"
DataGridView1.ForeColor = Color.Green
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Last Name"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "First Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Last Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Zone"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Sex"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Date of Birth"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Age"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Status"
DataGridView1.Columns(8).Width = 120
DataGridView1.Columns(9).HeaderText = "Religion"
DataGridView1.Columns(9).Width = 100
DataGridView1.Columns(10).HeaderText = "Nationality"
DataGridView1.Columns(10).Width = 120
DataGridView1.Columns(11).HeaderText = "Educational
Attaintment"
DataGridView1.Columns(11).Width = 200
DataGridView1.Columns(12).HeaderText = "Occupation"
DataGridView1.Columns(12).Width = 120
DataGridView1.Columns(13).HeaderText = "Employement"
DataGridView1.Columns(13).Width = 120
Case "Officials"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).Visible = False
DataGridView1.Columns(2).HeaderText = "Last Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "First Name"
DataGridView1.Columns(3).Width = 120
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

DataGridView1.Columns(4).HeaderText = "Middle Name"


DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Position"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Term"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Date Start"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Date End"
DataGridView1.Columns(8).Width = 120
DataGridView1.Columns(9).HeaderText = "Status"
DataGridView1.Columns(9).Width = 120
Case "Projects"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Zone"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "Project type"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Funded By"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Name of Donor"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Budget"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Date Started"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Date Finish"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Status"
Case "Household"
Call frmHouseholds.formatdgv()
End Select
End Sub

Private Sub txtsearch_TextChanged(sender As Object, e As EventArgs)


Handles txtsearch.TextChanged
Select Case Trim(Me.Text)
Case "Projects"
Call LoadRecord(dt, dtset, "tblproject", "Select * from
tblproject where ProjectType like '%" & txtsearch.Text & "%'", DataGridView1)
Case "Residents"
Call LoadRecord(dt, dtset, "tblResidents", "Select * FROM
tblResidents WHERE ResidentID Like '%" & txtsearch.Text & "%' or rLN like '%"
& txtsearch.Text & "%' or rFN like '%" & txtsearch.Text & "%'or rMN like '%" &
txtsearch.Text & "%'or rZone Like '%" & txtsearch.Text & "%'or rSex Like '%" &
txtsearch.Text & "%'", DataGridView1)
Case "Officials"
Call LoadRecord(dt, dtset, "qryOfficials", "Select * FROM
qryOfficials WHERE ResidentID Like '%" & txtsearch.Text & "%' or rLN Like '%"
& txtsearch.Text & "%'or rFN Like '%" & txtsearch.Text & "%'or rMN Like '%" &
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txtsearch.Text & "%'or rZone Like '%" & txtsearch.Text & "%'or rSex Like '%" &
txtsearch.Text & "%'", DataGridView1)
Case "HouseHold"
Call LoadRecord(dt, dtset, "qryHouseHold", "Select * from
qryHouseHolds1 Where HouseNo like '%" & txtsearch.Text & "%'", DataGridView1)
End Select
End Sub
Private Sub GroupBox5_Enter(sender As Object, e As EventArgs) Handles
GroupBox5.Enter

End Sub

Private Sub DataGridView1_CellContentClick(sender As Object, e As


DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

End Sub
End Class
“for issuances/certificates
Imports System.Data.OleDb
Public Class frmCer
Dim dt As New OleDbDataAdapter
Dim da As New DataSet
Private Sub frmCer_Activated(sender As Object, e As EventArgs) Handles
MyBase.Activated
Call LoadRecord(dt, da, "tblResidents", "Select * from tblResidents",
dgvresident)
End Sub

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


btnidigent.Click
Label1.Text = "Indigent"
If Label1.Text = "Indigent" Then
Call LoadRecord(dt, da, "tblIndigent", "Select * from
tblIndigent", dgvcertificates)
End If
End Sub

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


btnbus.Click
Label1.Text = "Business"
If Label1.Text = "Business" Then
Call LoadRecord(dt, da, "tblBusPer", "Select * from tblBusPer",
dgvcertificates)
End If
End Sub

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


MyBase.Load

End Sub
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End Class

“under seucirty
Public Class frmChangePassword

Private Sub frmChangePassword_Load(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles MyBase.Load
txtOPword.Clear()
txtNPword.Clear()
txtCPword.Clear()
End Sub

Private Sub txtNPword_TextChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles txtNPword.TextChanged
If txtNPword.Text.Length > 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
Dim numDigits As Integer = 0
Dim numAlpha As Integer = 0
Dim x As Integer
Dim s As String = Trim(txtNPword.Text)
For x = 0 To s.Length - 1
If Char.IsNumber(s(x)) Then
numDigits = numDigits + 1
End If
If Char.IsLetter(s(x)) Then
numAlpha = numAlpha + 1
End If
Next
If numDigits > 4 And numAlpha > 4 Then
lblPwordStrength.Text = "Strong"
lblPwordStrength.ForeColor = Color.Green
ElseIf numDigits > 2 And numAlpha > 2 Then
lblPwordStrength.Text = "Moderate"
lblPwordStrength.ForeColor = Color.Orange
ElseIf numDigits > 2 And numAlpha = 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
ElseIf numDigits = 0 And numAlpha > 2 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
End If
Else
lblPwordStrength.Text = ""
End If
End Sub

Private Sub btnChange_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnChange.Click
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

If Trim(txtOPword.Text) = "" Or Trim(txtNPword.Text) = "" Then


MsgBox("Unable to change password. Required fields missing!",
MsgBoxStyle.Information, "Change Password Failed")
Exit Sub
End If
If Trim(txtNPword.Text) <> Trim(txtCPword.Text) Then
MsgBox("Unable to change password. Passwords did not match!",
MsgBoxStyle.Information, "Change Password Failed")
Exit Sub
End If
executeSQLStatement("select Pword from tblSecurity where UName='" &
frmMain.Label23.Text & "'")
If MyDataSet.Tables(0).Rows.Count = 0 Then
MsgBox("Unable to change password. Invalid old password!",
MsgBoxStyle.Information, "Change Password Failed")
Exit Sub
End If
Dim a As String = MyDataSet.Tables(0).Rows(0).Item(0).ToString
If a <> Trim(txtOPword.Text) Then
for add an account on security
Imports System.Data.OleDb

Public Class frmaeacounts

Private Sub frmaeacounts_Activated(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.Activated

End Sub

Private Sub AEUsers_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
Call konneksyon()
Call FillComboBox()
Call PwordStrength()
Call Pwordmatch()
End Sub

Protected Overrides ReadOnly Property CreateParams() As


System.Windows.Forms.CreateParams
'to disable the alt+f4
Get
Dim cp As CreateParams = MyBase.CreateParams
Const CS_NOCLOSE As Integer = &H200
cp.ClassStyle = cp.ClassStyle Or CS_NOCLOSE
Return cp
End Get
End Property

Function clear()
txtFName.Clear()
txtUName.Clear()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txtPword.Clear()
txtPwordMatch.Clear()
cboAccType.Text = ""
cboSQ.Text = ""
txtSQA.Clear()
Return True
End Function

Function FillComboBox()
cboAccType.Items.Clear()
cboAccType.Items.Add("Administrator")
cboAccType.Items.Add("User")

cboSQ.Items.Clear()
cboSQ.Items.Add("What is your nickname?")
cboSQ.Items.Add("What is your favorite food?")
cboSQ.Items.Add("What is your favorite book?")
cboSQ.Items.Add("What is your favorite color?")
cboSQ.Items.Add("What is the name of your pet?")
Return True
End Function

Function save()
If Trim(txtResientID.Text) <> "" And Trim(txtFName.Text) <> "" And
Trim(txtUName.Text) <> "" And Trim(txtPword.Text) <> "" And
Trim(txtPwordMatch.Text) <> "" And Trim(cboAccType.Text) <> "" And
Trim(cboSQ.Text) <> "" And Trim(txtSQA.Text) <> "" Then
If Trim(txtUName.Text.Length) >= 8 Then
If Trim(txtPword.Text.Length) >= 8 Then
If Trim(txtSQA.Text.Length) >= 8 Then
If lblPwordMatch.Text = "Passwords matched" Then
If AEswitch = "a" Then
sql = "insert into tblSecurity values('" &
txtResientID.Text & "','" & txtFName.Text & "','" & txtUName.Text & "','" &
txtPword.Text & "','" & cboAccType.Text & "','" & cboSQ.Text & "','" &
txtSQA.Text & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
Call frmUserAccount.FillDataGrid()
MsgBox("Record successfully saved.",
MsgBoxStyle.Information, "System Message")
Call AddLog()
AEswitch = ""
Me.Close()
Else
sql = "update tblSecurity set ResidentID='" &
txtResientID.Text & "',FName='" & txtFName.Text & "',UName='" & txtUName.Text
& "',Pword='" & txtPword.Text & "',AccType='" & cboAccType.Text & "',SQ='" &
cboSQ.Text & "',SQA='" & txtSQA.Text & "' where UName='" &
frmUserAccount.txtSelectedCode.Text & "'"
cmd = New OleDbCommand(sql, kon)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

cmd.ExecuteNonQuery()
If frmMain.Label23.Text =
frmUserAccount.txtSelectedCode.Text Then
frmMain.Label23.Text = txtUName.Text
frmMain.lblaccess.Text = cboAccType.Text
End If
Call frmUserAccount.FillDataGrid()
frmMain.lblaccess.Text = cboAccType.Text

MsgBox("Record successfully updated.",


MsgBoxStyle.Information, "System Message")
Call EditLog()
AEswitch = ""
Me.Close()
End If
Else
MsgBox("Unable to save. Passwords did not match",
MsgBoxStyle.Information, "System Message")
End If
Else
MsgBox("Security Answer too short. Password must be
minimum of 8 characters.", MsgBoxStyle.Information, "System Message")
txtSQA.Clear()
txtSQA.Focus()
End If
Else
MsgBox("Password too short. Password must be minimum of 8
characters.", MsgBoxStyle.Information, "System Message")
txtPword.Clear()
txtPwordMatch.Clear()
txtPword.Focus()
End If
Else
MsgBox("Username too short. Username must be minimum of 8
characters.", MsgBoxStyle.Information, "System Message")
txtUName.Clear()
txtUName.Focus()
End If
Else
MsgBox("Unable to save. Empty entries not allowed",
MsgBoxStyle.Information, "System Message")
End If
Return True
End Function

Function Pwordmatch()
If Trim(txtPword.Text) <> "" And Trim(txtPwordMatch.Text) <> "" Then
If Trim(txtPwordMatch.Text) = Trim(txtPword.Text) Then
lblPwordMatch.Text = "Passwords matched"
lblPwordMatch.ForeColor = Color.Green
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Else
lblPwordMatch.Text = "Passwords do not match"
lblPwordMatch.ForeColor = Color.Red
End If
Else
lblPwordMatch.Text = ""
End If
Return True
End Function

Function PwordStrength()
If txtPword.Text.Length > 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
Dim numDigits As Integer = 0
Dim numAlpha As Integer = 0
Dim x As Integer
Dim s As String = Trim(txtPword.Text)
For x = 0 To s.Length - 1
If Char.IsNumber(s(x)) Then
numDigits = numDigits + 1
End If
If Char.IsLetter(s(x)) Then
numAlpha = numAlpha + 1
End If
Next
If numDigits > 4 And numAlpha > 4 Then
lblPwordStrength.Text = "Strong"
lblPwordStrength.ForeColor = Color.Green
ElseIf numDigits > 2 And numAlpha > 2 Then
lblPwordStrength.Text = "Moderate"
lblPwordStrength.ForeColor = Color.Orange
ElseIf numDigits > 2 And numAlpha = 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
ElseIf numDigits = 0 And numAlpha > 2 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
End If
Else
lblPwordStrength.Text = ""
End If
Return True
End Function

Function AddLog()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

act = "Added new system user account. Username: " & txtUName.Text

sql = "insert into tblSystemLog values('" & frmMain.Label23.Text &


"','" & act & "','" & currDate & "','" & currTime & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
Return True
End Function

Function EditLog()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String

act = "Edited system user account.Username: " &


frmUserAccount.txtSelectedCode.Text & " to " & txtUName.Text

sql = "insert into SystemLog values('" & frmMain.lblaccess.Text &


"','" & act & "','" & currDate & "','" & currTime & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
Return True
End Function

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSave.Click
If cboAccType.Text = "User" Then
executeSQLStatement("select * from tblSecurity where AccType='" &
Trim(frmUserAccount.dgUsers.CurrentRow.Cells(4).Value.ToString) & "'")
If frmUserAccount.dgUsers.Rows.Count > 19 Then
MsgBox("Sorry The User Account is Already full!",
MsgBoxStyle.Critical, "System Message")
Else
save()
End If
ElseIf cboAccType.Text = "Administrator" Then
executeSQLStatement("select * from tblSecurity where AccType='" &
Trim(frmUserAccount.dgUsers.CurrentRow.Cells(4).Value.ToString) & "'")
If frmUserAccount.dgUsers.Rows.Count > 1 Then
MsgBox("There are only 1 Admins allowed!",
MsgBoxStyle.Critical, "System Message")
Else

save()
End If
End If

End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCancel.Click
AEswitch = ""
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Me.Close()
End Sub

Private Sub txtUName_LostFocus(ByVal sender As Object, ByVal e As


System.EventArgs) Handles txtUName.LostFocus
If AEswitch = "a" Then
sql = "select * from tblSecurity where UName='" & txtUName.Text &
"'"
da = New OleDbDataAdapter(sql, kon)
ds = New DataSet
da.Fill(ds, "Security")
If ds.Tables("Security").Rows.Count <> 0 Then
MsgBox("Username already exist, please change",
MsgBoxStyle.Information, "System Message")
txtUName.Clear()
txtUName.Focus()
Exit Sub
End If
Else
sql = "select * from tblSecurity where UName='" & txtUName.Text &
"'"
da = New OleDbDataAdapter(sql, kon)
ds = New DataSet
da.Fill(ds, "Security")
If ds.Tables("Security").Rows.Count <> 0 And txtUName.Text <>
frmUserAccount.txtSelectedCode.Text Then
MsgBox("Username already exist, please change",
MsgBoxStyle.Information, "System Message")
txtUName.Text = frmUserAccount.txtSelectedCode.Text
txtUName.Focus()
Exit Sub
End If
End If
End Sub

Private Sub txtPword_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txtPword.TextChanged
Call PwordStrength()
Call Pwordmatch()
End Sub

Private Sub txtPwordMatch_TextChanged(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles txtPwordMatch.TextChanged
Call Pwordmatch()
End Sub

Private Sub chkShowChar_CheckedChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles chkShowChar.CheckedChanged
If chkShowChar.CheckState = CheckState.Checked Then
txtSQA.UseSystemPasswordChar = False
Else
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txtSQA.UseSystemPasswordChar = True
End If
End Sub

Private Sub txtFName_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtFName.KeyPress
If Asc(e.KeyChar) = 13 Then
txtUName.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtUName_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtUName.KeyPress
If Asc(e.KeyChar) = 13 Then
txtPword.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtPword_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtPword.KeyPress
If Asc(e.KeyChar) = 13 Then
txtPwordMatch.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtPwordMatch_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtPwordMatch.KeyPress
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

If Asc(e.KeyChar) = 13 Then
cboAccType.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub cboAccType_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles cboAccType.KeyPress
If Asc(e.KeyChar) = 13 Then
cboSQ.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String = ""
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub cboSQ_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles cboSQ.KeyPress
If Asc(e.KeyChar) = 13 Then
txtSQA.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String = ""
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtSQA_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtSQA.KeyPress
If Asc(e.KeyChar) = 13 Then
chkShowChar.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

e.Handled = True
End If
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim frm As New frmseach23
frm.Text = "Select Person"
frmseach23.ShowDialog()
End Sub
End Class

“ for add dead person

Imports System.Data.OleDb
Public Class frmAEdeadnotes
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet

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


btnBrowse.Click
Dim frm As New FrmSearchRecord1
frm.Text = "Select Dead Person"
frm.ShowDialog()
End Sub

Sub save()
If Trim(Me.Text) = "Add Dead Person" Then
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tbldeadnotes([FullName],
[BirthDate],[Age],[dateofDeath],[Zone]) values ('" & txtfullname.Text & "','"
& txtdateofbirth.Text & "'," & txtage.Text & ",'" & DateTimePicker1.Text &
"','" & txtzone.Text & "')"
kom.ExecuteNonQuery()
kom.CommandText = "Delete * from tblresidents where ResidentID=" &
txtid.Text
kom.ExecuteNonQuery()
Call frmRecord.pupulate()
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
Log()
Me.Close()
Else
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "update [tbldeadnotes] set [FullName]='" &
txtfullname.Text & "', [BirthDate]='" & txtdateofbirth.Text & "', [Age]=" &
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txtage.Text & ", [dateofDeath]='" & DateTimePicker1.Text & "', [Zone]='" &
txtzone.Text & "' Where [ID]=" & txtsel.Text
kom.ExecuteNonQuery()
MsgBox("Record Updated!", MsgBoxStyle.Information, "Saved")
Log1()
Me.Close()
End If
End Sub
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Dead Person: " + txtfullname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Added Dead Person: " + txtfullname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Private Sub btnsave_Click(sender As Object, e As EventArgs) Handles
btnsave.Click
save()

End Sub

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


btncancel.Click
Me.Hide()
End Sub

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


MyBase.Load
Call konneksyon()
End Sub
End Class
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

“ for add officals

Imports System.Data.OleDb
Public Class frmAEofficials
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles
btnSave.Click
saveRecord()
End Sub
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = " Added Officials: " + cmbPostion.Text + ": " + txtlname.Text +
" " + txtfname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Official: " + cmbPostion.Text + ": " + txtlname.Text +
" " + txtfname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Sub saveRecord()
'trapping
Dim a As String
a = "Active"
If txtresidentID.Text = "" Or cmbPostion.Text = "" Or cmbTerm.Text =
"" Or cmbDateStart.Text = "" Or cmdateEnd.Text = "" Then
MsgBox("Cannot save. Required field missing!",
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Empty fields")
Exit Sub
End If
If Trim(Me.Text) = "Add Officials" Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

If Trim(cmbPostion.Text) = "Brgy. Secretary" Or


Trim(cmbPostion.Text) = "Brgy. Captain" Or Trim(cmbPostion.Text) = "Brgy.
Treasurer" Or Trim(cmbPostion.Text) = "Brgy. SK Chairman" Then
Call LoadRecord(da, dset, "[tblOfficials]", "Select * from
[tblOfficials] where [Position] = '" & Trim(cmbPostion.Text) & "'")

If (dset.Tables(0).Rows.Count <> 0) Then


MsgBox("Cannot have more than 1 official in this
position!", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Warning")
Exit Sub

End If

End If
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblOfficials([ResidentID],
[Position],[Term],[DateStart],[DateEnd],[Status]) values (" &
txtresidentID.Text & ",'" & cmbPostion.Text & "','" & cmbTerm.Text & "','" &
cmbDateStart.Text & "','" & cmdateEnd.Text & "','" & a & "')"
kom.ExecuteNonQuery()
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
Log()
clear()
Me.Close()

Else

kom = New OleDbCommand


kom.Connection = kon
kom.CommandText = "update [tblOfficials] set [ResidentID]=" &
txtresidentID.Text & ", [Position]='" & cmbPostion.Text & "', [Term]='" &
cmbTerm.Text & "', [DateStart]='" & cmbDateStart.Text & "', [DateEnd]='" &
cmdateEnd.Text & "'Where [OfficialsID]=" & txtID.Text
kom.ExecuteNonQuery()
MsgBox("Record Updated!", MsgBoxStyle.Information, "Saved")
Log1()
Me.Close()
clear()
End If
End Sub
Sub clear()
txtfname.Text = ""
txtfnmae.Text = ""
txtGender.Text = ""
txtID.Text = ""
txtlname.Text = ""
txtmidname.Text = ""
txtmname.Text = ""
txtname.Text = ""
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txtresidentID.Text = ""
txtzone.Text = ""
End Sub

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


MyBase.Load
cmbPostion.Items.Clear()
cmbPostion.Items.Add("Brgy. Captain")
cmbPostion.Items.Add("Brgy. Kagawad")
cmbPostion.Items.Add("Brgy. Secretary")
cmbPostion.Items.Add("Brgy. Treasurer")
cmbPostion.Items.Add("Brgy. Auditor")
cmbPostion.Items.Add("Brgy. SK Chairman")
cmbPostion.Items.Add("Brgy. SK Kagawad")
End Sub

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


btnbrowse.Click
Dim frm As New FrmSearchRecord1
frm.Text = "Select Officials"
frm.ShowDialog()
End Sub

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


btncancel.Click
Me.Close()
End Sub
End Class
“for add projects
Imports System.Data.OleDb
Public Class frmAEprojects
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet
Private Sub btnsave_Click(sender As Object, e As EventArgs) Handles
btnsave.Click
saveRecord()
End Sub
Sub clear()
txtbud.Text = ""
txtdonor.Text = ""
txtfun.Text = ""
txtpro.Text = ""
cmbzone.Text = ""
End Sub
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

act = " Added Project: " + txtpro.Text


kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Project: " + txtpro.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Sub saveRecord()
'trapping
If cmbzone.Text = "" Or txtpro.Text = "" Or txtfun.Text = "" Or
txtdonor.Text = "" Or txtbud.Text = "" Or txtdates.Text = "" Or txtdatef.Text
= "" Then
MsgBox("Cannot save. Required field missing!",
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Empty fields")
Exit Sub
End If
'ADD
If Trim(Me.Text) = "Add Project" Then
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblProject([Zone],[ProjectType],
[FundedBy],[NameOfDonor],[Budget],[DateStarted],[DateFinish],[Status]) values
('" & cmbzone.Text & "','" & txtpro.Text & "','" & txtfun.Text & "','" &
txtdonor.Text & "'," & txtbud.Text & ",'" & txtdates.Text & "','" &
txtdatef.Text & "','" & txtstat.Text & "')"
kom.ExecuteNonQuery()
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
Log()
Me.Close()
Else
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "update [tblProject] set [Zone]='" &
cmbzone.Text & "', [ProjectType]='" & txtpro.Text & "', [FundedBy]='" &
txtfun.Text & "', [NameOfDonor]='" & txtdonor.Text & "', [Budget]=" &
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txtbud.Text & ",[DateStarted]='" & txtdates.Text & "',[DateFinish]='" &


txtdatef.Text & "',[Status]='" & txtstat.Text & "' Where [ID]=" & txtsel.Text
kom.ExecuteNonQuery()
MsgBox("Record Updated!", MsgBoxStyle.Information, "Saved")
Log1()
Me.Close()
End If
End Sub

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


Handles txtbud.KeyPress
If Asc(e.KeyChar) = 13 Then
txtbud.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String = "0123456789. "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub
Private Sub frmAEprojects_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
cmbzone.Items.Clear()
cmbzone.Items.Add("Zone 1")
cmbzone.Items.Add("Zone 2")
cmbzone.Items.Add("Zone 3")
cmbzone.Items.Add("Zone 4")
cmbzone.Items.Add("Zone 5")
cmbzone.Items.Add("Zone 6")
cmbzone.Items.Add("Zone 7")
End Sub

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


txtbud.TextChanged

End Sub

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


txtdonor.TextChanged

End Sub

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


Handles txtdonor.KeyPress
If Asc(e.KeyChar) = 13 Then
txtdonor.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

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


txtfun.TextChanged

End Sub

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


Handles txtfun.KeyPress
If Asc(e.KeyChar) = 13 Then
txtfun.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

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


txtstat.TextChanged

End Sub

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


Handles txtstat.KeyPress
If Asc(e.KeyChar) = 13 Then
txtstat.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub
End Class
“for add residents
Imports System.Data.OleDb
Public Class frmAEresidents
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

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


btnSave.Click
saveRecord()

End Sub
Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = " Added Resident: " + txtLname.Text + ": " + txtFName.Text + " "
+ txtMname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Function Log1()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String
act = "Updated Resident: " + txtLname.Text + ": " + txtFName.Text + "
" + txtMname.Text
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblSystemLog Values ('" &
frmMain.Label23.Text & "','" & act & "','" & currDate & "','" & currTime &
"')"
kom.ExecuteNonQuery()
Return True
End Function
Sub clear()

txtage.Text = ""
txteduca.Text = ""
txtemplo.Text = ""
txtFName.Text = ""
txtID.Text = ""
txtLname.Text = ""
txtMname.Text = ""
txtnationality.Text = ""
txtoccu.Text = ""
cmbcivil.Text = ""
cmbdate.Text = ""
cmbsex.Text = ""
cmbzone.Text = ""
cmreligion.Text = ""

End Sub
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Sub saveRecord()
If txtLname.Text = "" Or txtFName.Text = "" Or txtMname.Text = "" Or
cmbsex.Text = "" Or cmbcivil.Text = "" Or txtage.Text = "" Or cmbzone.Text =
"" Or cmbsex.Text = "" Or cmreligion.Text = "" Or txtoccu.Text = "" Or
txteduca.Text = "" Then
MsgBox("Cannot save. Required field missing!",
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Empty fields")
Exit Sub
End If

If Me.Text = "Add Residents" Then


kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into
tblResidents(rLN,rFN,rMN,rZone,rSex,rDOB,rAge,rCstatus,rReligion,rNationality,
rEducatt,roccuption,rEmployment,PWD,PPF) values ('" & txtLname.Text & "','" &
txtFName.Text & "','" & txtMname.Text & "','" & cmbzone.Text & "','" &
cmbsex.Text & "','" & cmbdate.Text & "'," & txtage.Text & ",'" & cmbcivil.Text
& "','" & cmreligion.Text & "','" & txtnationality.Text & "','" &
txteduca.Text & "','" & txtoccu.Text & "','" & txtemplo.Text & "','" &
cmpwd.Text & "','" & cmb4ps.Text & "')"
kom.ExecuteNonQuery()
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
Log()
clear()
Me.Close()
Else
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "update tblResidents set rLN='" & txtLname.Text
& "', rFN='" & txtFName.Text & "', rMN='" & txtMname.Text & "', rZone='" &
cmbzone.Text & "', rSex='" & cmbsex.Text & "', rDOB='" & cmbdate.Text & "',
rAge='" & txtage.Text & "', rCstatus='" & cmbcivil.Text & "', rReligion='" &
cmreligion.Text & "', rNationality='" & txtnationality.Text & "', rEducatt='"
& txteduca.Text & "', roccuption='" & txtoccu.Text & "', PWD='" & cmpwd.Text &
"', PPF='" & cmb4ps.Text & "' where ResidentID=" & txtID.Text & ""
kom.ExecuteNonQuery()
MsgBox("Record Updated!", MsgBoxStyle.Information, "Saved")
Log1()
clear()
Me.Close()
End If
End Sub

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


cmbdate.ValueChanged
If cmbdate.Text = "" Then
Exit Sub
End If
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Dim dobdate As Integer = Val(Format(CDate(cmbdate.Text), "dd"))


Dim datenow As Integer = Val(Format(Now, "dd"))
Dim x As Integer = DateDiff(DateInterval.Year, CDate(cmbdate.Text),
CDate(currDate))
If Month(currDate) < Month(cmbdate.Text) Then
txtage.Text = x - 1
ElseIf Month(currDate) = Month(cmbdate.Text) And Year(currDate) >
Year(cmbdate.Text) Then
txtage.Text = x
If dobdate < datenow Then
txtage.Text = x - 1

End If
Else

txtage.Text = x

End If

End Sub
Private Sub frmAEresidents_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
FillComboBoxes("SELECT DISTINCT (rLN) from tblResidents", cmreligion,
"rLN")
'fillreligion()
fillcivilStatus()
fillzone()
fillgender()
educatt()
End Sub
Function fillreligion()
cmreligion.Items.Clear()
cmreligion.Items.Add("Catholic")
cmreligion.Items.Add("Jehova Witnesses")
cmreligion.Items.Add("Dating Daan")
cmreligion.Items.Add("Born Again")
cmreligion.Items.Add("Dating Daan")
cmreligion.Items.Add("Penticost")
cmreligion.Items.Add("Methodist")
cmreligion.Items.Add("Islam")
Return True
End Function
Function fillgender()
cmbsex.Items.Clear()
cmbsex.Items.Add("Male")
cmbsex.Items.Add("Female")
Return True
End Function
Function fillzone()
cmbzone.Items.Clear()
cmbzone.Items.Add("Zone 1")
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

cmbzone.Items.Add("Zone 2")
cmbzone.Items.Add("Zone 3")
cmbzone.Items.Add("Zone 4")
cmbzone.Items.Add("Zone 5")
cmbzone.Items.Add("Zone 6")
cmbzone.Items.Add("Zone 7")
Return True
End Function
Function fillcivilStatus()
cmbcivil.Items.Clear()
cmbcivil.Items.Add("SINGLE")
cmbcivil.Items.Add("MARRIED")
cmbcivil.Items.Add("SEPERATED")
cmbcivil.Items.Add("WIDOWED")
Return True
End Function
Function educatt()
txteduca.Items.Clear()
txteduca.Items.Add("NONE")
txteduca.Items.Add("PRE-SCHOOL")
txteduca.Items.Add("ELEMENTARY LEVEL")
txteduca.Items.Add("HIGH SCHOOL LEVEL")
txteduca.Items.Add("VOCATIONAL")
txteduca.Items.Add("COLLEGE LEVEL")
txteduca.Items.Add("COLLEGE GRADUATE")
txteduca.Items.Add("POST BACCALAUREATE")
Return True
End Function
Private Sub txtLname_KeyPress(sender As Object, e As KeyPressEventArgs)
Handles txtLname.KeyPress
If Asc(e.KeyChar) = 13 Then
txtLname.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub
Private Sub txtFName_KeyPress(sender As Object, e As KeyPressEventArgs)
Handles txtFName.KeyPress
If Asc(e.KeyChar) = 13 Then
txtFName.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End If
End If
End Sub

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


Handles txtMname.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMname.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtnationality_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles txtnationality.KeyPress
If Asc(e.KeyChar) = 13 Then
txtnationality.Focus()
txtoccu.Focus()
End If
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

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


txtFName.TextChanged

End Sub

Private Sub cmbsex_SelectedIndexChanged(sender As Object, e As EventArgs)


Handles cmbsex.SelectedIndexChanged

End Sub

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


txtemplo.TextChanged
If txtemplo.Text = "NONE" Then
txtoccu.Text = "NONE"
Else
txtoccu.Text = ""
End If
End Sub
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Private Sub cmreligion_SelectedIndexChanged(sender As Object, e As


EventArgs) Handles cmreligion.SelectedIndexChanged

End Sub
End Class

“For data archives


Imports System.Data.OleDb
Public Class frmArchives
Dim dt As New OleDbDataAdapter
Dim dtset As DataSet
Dim kom As New OleDbCommand
Dim dgFont As New Font("Cambria", 10)
Sub pupulate()
Select Case Trim(Me.Text)
Case "Residents"
'Call konneksyon()
lblarchives.Text = "Resident Archive"
Call LoadRecord(dt, dtset, "tblResidentArchive", "Select *
from tblResidentArchive", DataGridView1)
lblcount.Text = dtset.Tables("tblResidentArchive").Rows.Count
& "Records found!"
formatgrid()
Case "Officials"
'Call konneksyon()
lblarchives.Text = "Official Archive"
Call LoadRecord(dt, dtset, "tblOfficialsArchive", "Select *
from tblOfficialsArchive", DataGridView1)
lblcount.Text = dtset.Tables("tblOfficialsArchive").Rows.Count
& "Records found!"
formatgrid()
Case "Household"
lblarchives.Text = "HouseHold Archive"
Call LoadRecord(dt, dtset, "tblhHarchive", "Select * from
tblhHarchive", DataGridView1)
lblcount.Text = dtset.Tables("tblhHarchive").Rows.Count &
"Records found!"
frmHouseholds.formatdgv()
'formatgrid()
Case "Projects"
lblarchives.Text = "Projects Archives"
Call LoadRecord(dt, dtset, "tblProjectArchive", "Select * from
tblProjectArchive", DataGridView1)
lblcount.Text = dtset.Tables("tblProjectArchive").Rows.Count &
"Records found!"
formatdgv()
End Select
End Sub
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

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


MyBase.Load
Call konneksyon()
Call pupulate()
End Sub
Sub formatdgv()
With DataGridView1
.Font = dgFont
.Columns(0).HeaderText = "House No"
.Columns(0).Width = 120
.Columns(1).HeaderText = "Zone"
.Columns(1).Width = 120
.Columns(2).HeaderText = "T-House"
.Columns(2).Width = 120
.Columns(3).HeaderText = "T-Lot"
.Columns(3).Width = 120
.Columns(4).HeaderText = "Water Resources"
.Columns(4).Width = 200
.Columns(5).HeaderText = "Number of Family"
.Columns(5).Width = 250
.Columns(6).HeaderText = "Electric"
.Columns(6).Width = 120
.Columns(7).HeaderText = "Water Sealed"
.Columns(7).Width = 250
.Columns(8).HeaderText = "House Made-Up"
.Columns(8).Width = 230
.Columns(9).HeaderText = "Auto Vehicle"
.Columns(9).Width = 120
.Columns(10).HeaderText = "Business"
.Columns(10).Width = 120
.Columns(11).HeaderText = "Pets"
.Columns(11).Width = 220
.Columns(12).HeaderText = "Family OFW"
.Columns(12).Width = 220
.Columns(13).HeaderText = "Farms"
.Columns(13).Width = 120
.Columns(14).HeaderText = "Family OFW"
.Columns(14).Width = 220
.Columns(15).Visible = False
.Columns(16).HeaderText = "Head Name"
.Columns(16).Width = 220
.Columns(17).HeaderText = "Sex"
.Columns(17).Width = 120
.Columns(18).HeaderText = "Date of Birth"
.Columns(18).Width = 200
.Columns(19).HeaderText = "Age"
.Columns(19).Width = 120
.Columns(20).HeaderText = "Civil Status"
.Columns(20).Width = 120
.Columns(21).HeaderText = "Religion"
.Columns(21).Width = 120
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

.Columns(22).HeaderText = "Nationality"
.Columns(22).Width = 120
.Columns(23).HeaderText = "Occupation"
.Columns(23).Width = 120
.Columns(24).HeaderText = "Employement"
.Columns(24).Width = 120
End With
End Sub
'Case "SeniorCitizen"
' DataGridView1.Font = dgFont
' DataGridView1.Columns(0).HeaderText = "Resident ID"
' DataGridView1.Columns(0).Width = 120
' DataGridView1.Columns(1).HeaderText = "Last Name"
' DataGridView1.Columns(1).Width = 120
' DataGridView1.Columns(2).HeaderText = "First Name"
' DataGridView1.Columns(2).Width = 120
' DataGridView1.Columns(3).HeaderText = "Last Name"
' DataGridView1.Columns(3).Width = 120
' DataGridView1.Columns(4).HeaderText = "Zone"
' DataGridView1.Columns(4).Width = 70
' DataGridView1.Columns(5).HeaderText = "Sex"
' DataGridView1.Columns(5).Width = 70
' DataGridView1.Columns(6).HeaderText = "Date of Birth"
' DataGridView1.Columns(6).Width = 120
' DataGridView1.Columns(7).HeaderText = "Age"
' DataGridView1.Columns(7).Width = 50
' DataGridView1.Columns(8).Visible = False
' DataGridView1.Columns(9).Visible = False
' DataGridView1.Columns(10).Visible = False
' DataGridView1.Columns(11).Visible = False
' DataGridView1.Columns(12).Visible = False
' DataGridView1.Columns(13).Visible = False
Sub formatgrid()
Select Case Trim(Me.Text)
Case "Residents"
DataGridView1.ForeColor = Color.Green
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Last Name"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "First Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Last Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Zone"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Sex"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Date of Birth"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Age"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Status"
DataGridView1.Columns(8).Width = 120
DataGridView1.Columns(9).HeaderText = "Religion"
DataGridView1.Columns(9).Width = 100
DataGridView1.Columns(10).HeaderText = "Nationality"
DataGridView1.Columns(10).Width = 120
DataGridView1.Columns(11).HeaderText = "Educational
Attaintment"
DataGridView1.Columns(11).Width = 200
DataGridView1.Columns(12).HeaderText = "Occupation"
DataGridView1.Columns(12).Width = 120
DataGridView1.Columns(13).HeaderText = "Employement"
DataGridView1.Columns(13).Width = 120
Case "Officials"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).Visible = False
DataGridView1.Columns(2).HeaderText = "Last Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "First Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Middle Name"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Position"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Term"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Date Start"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Date End"
DataGridView1.Columns(8).Width = 120
DataGridView1.Columns(9).HeaderText = "Status"
DataGridView1.Columns(9).Width = 120
Case "Projects"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Zone"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "Project type"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Funded By"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Name of Donor"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Budget"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Date Started"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Date Finish"
DataGridView1.Columns(7).Width = 120
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

DataGridView1.Columns(8).HeaderText = "Status"
Case "Household"
Call frmHouseholds.formatdgv()
End Select
End Sub

Private Sub txtsearch_TextChanged(sender As Object, e As EventArgs)


Handles txtsearch.TextChanged
Select Case Trim(Me.Text)
Case "Projects"
Call LoadRecord(dt, dtset, "tblproject", "Select * from
tblproject where ProjectType like '%" & txtsearch.Text & "%'", DataGridView1)
Case "Residents"
Call LoadRecord(dt, dtset, "tblResidents", "Select * FROM
tblResidents WHERE ResidentID Like '%" & txtsearch.Text & "%' or rLN like '%"
& txtsearch.Text & "%' or rFN like '%" & txtsearch.Text & "%'or rMN like '%" &
txtsearch.Text & "%'or rZone Like '%" & txtsearch.Text & "%'or rSex Like '%" &
txtsearch.Text & "%'", DataGridView1)
Case "Officials"
Call LoadRecord(dt, dtset, "qryOfficials", "Select * FROM
qryOfficials WHERE ResidentID Like '%" & txtsearch.Text & "%' or rLN Like '%"
& txtsearch.Text & "%'or rFN Like '%" & txtsearch.Text & "%'or rMN Like '%" &
txtsearch.Text & "%'or rZone Like '%" & txtsearch.Text & "%'or rSex Like '%" &
txtsearch.Text & "%'", DataGridView1)
Case "HouseHold"
Call LoadRecord(dt, dtset, "qryHouseHold", "Select * from
qryHouseHolds1 Where HouseNo like '%" & txtsearch.Text & "%'", DataGridView1)
End Select
End Sub
Private Sub GroupBox5_Enter(sender As Object, e As EventArgs) Handles
GroupBox5.Enter

End Sub

Private Sub DataGridView1_CellContentClick(sender As Object, e As


DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

End Sub
End Class
“for issuances/certificates
Imports System.Data.OleDb
Public Class frmCer
Dim dt As New OleDbDataAdapter
Dim da As New DataSet
Private Sub frmCer_Activated(sender As Object, e As EventArgs) Handles
MyBase.Activated
Call LoadRecord(dt, da, "tblResidents", "Select * from tblResidents",
dgvresident)
'Call LoadRecord(dt, da, "tblBusPer", "Select * from tblBusPer", dgvp)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

'Call LoadRecord(dt, da, "tblIndigent", "Select * from tblIndigent",


dgvi)
End Sub

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


btnidigent.Click
Label1.Text = "Indigent"
If Label1.Text = "Indigent" Then
Call LoadRecord(dt, da, "tblIndigent", "Select * from
tblIndigent", dgvcertificates)
End If
End Sub

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


btnbus.Click
Label1.Text = "Business"
If Label1.Text = "Business" Then
Call LoadRecord(dt, da, "tblBusPer", "Select * from tblBusPer",
dgvcertificates)
End If
End Sub

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


MyBase.Load

End Sub
End Class

“under seucirty
Public Class frmChangePassword

Private Sub frmChangePassword_Load(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles MyBase.Load
txtOPword.Clear()
txtNPword.Clear()
txtCPword.Clear()
End Sub

Private Sub txtNPword_TextChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles txtNPword.TextChanged
If txtNPword.Text.Length > 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
Dim numDigits As Integer = 0
Dim numAlpha As Integer = 0
Dim x As Integer
Dim s As String = Trim(txtNPword.Text)
For x = 0 To s.Length - 1
If Char.IsNumber(s(x)) Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

numDigits = numDigits + 1
End If
If Char.IsLetter(s(x)) Then
numAlpha = numAlpha + 1
End If
Next
If numDigits > 4 And numAlpha > 4 Then
lblPwordStrength.Text = "Strong"
lblPwordStrength.ForeColor = Color.Green
ElseIf numDigits > 2 And numAlpha > 2 Then
lblPwordStrength.Text = "Moderate"
lblPwordStrength.ForeColor = Color.Orange
ElseIf numDigits > 2 And numAlpha = 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
ElseIf numDigits = 0 And numAlpha > 2 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
End If
Else
lblPwordStrength.Text = ""
End If
End Sub

Private Sub btnChange_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnChange.Click
If Trim(txtOPword.Text) = "" Or Trim(txtNPword.Text) = "" Then
MsgBox("Unable to change password. Required fields missing!",
MsgBoxStyle.Information, "Change Password Failed")
Exit Sub
End If
If Trim(txtNPword.Text) <> Trim(txtCPword.Text) Then
MsgBox("Unable to change password. Passwords did not match!",
MsgBoxStyle.Information, "Change Password Failed")
Exit Sub
End If
executeSQLStatement("select Pword from tblSecurity where UName='" &
frmMain.Label23.Text & "'")
If MyDataSet.Tables(0).Rows.Count = 0 Then
MsgBox("Unable to change password. Invalid old password!",
MsgBoxStyle.Information, "Change Password Failed")
Exit Sub
End If
Dim a As String = MyDataSet.Tables(0).Rows(0).Item(0).ToString
If a <> Trim(txtOPword.Text) Then
cmAutoVehicle.Items.Add("Three Weels")
cmAutoVehicle.Items.Add("Two Wheels Motor")
cmAutoVehicle.Items.Add("None")
End Sub
Sub pets()
cmbpet.Items.Clear()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

cmbpet.Items.Add("Yes")
cmbpet.Items.Add("No")
End Sub
Sub housemade()
cmbhmadeup.Items.Clear()
cmbhmadeup.Items.Add("Concrete")
cmbhmadeup.Items.Add("Semi Concrete")
cmbhmadeup.Items.Add("Bamboo Wood")
End Sub
Sub waterseal()
cmbwaterseal.Items.Clear()
cmbwaterseal.Items.Add("W/ Water Seal")
cmbwaterseal.Items.Add("W/out Water Seal")
End Sub
Sub electric()
cmbElectric.Items.Clear()
cmbElectric.Items.Add("W/ Electric")
cmbElectric.Items.Add("W/out Electric")
End Sub
Sub ofw()
cmbOFW.Items.Clear()
cmbOFW.Items.Add("Yes")
cmbOFW.Items.Add("No")
End Sub
Sub farm()
cmbFarm.Items.Clear()
cmbFarm.Items.Add("Yes")
cmbFarm.Items.Add("No")
End Sub

Sub ReloadRecords()
executeSQLStatement("select * from qryHouseHolds1 order by HouseNo")
dgv.DataSource = MyDataSet.Tables(0)
lblRecFound.Text = "Record(s) found: " &
MyDataSet.Tables(0).Rows.Count
formatdgv()
End Sub
Sub formatdgv()
dgv.Font = dgFont
dgv.Columns(0).HeaderText = "House No"
dgv.Columns(0).Width = 120
dgv.Columns(1).HeaderText = "Zone"
dgv.Columns(1).Width = 120
dgv.Columns(2).HeaderText = "T-House"
dgv.Columns(2).Width = 120
dgv.Columns(3).HeaderText = "T-Lot"
dgv.Columns(3).Width = 120
dgv.Columns(4).HeaderText = "Water Resources"
dgv.Columns(4).Width = 200
dgv.Columns(5).HeaderText = "Number of Family"
dgv.Columns(5).Width = 250
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

dgv.Columns(6).HeaderText = "Electric"
dgv.Columns(6).Width = 120
dgv.Columns(7).HeaderText = "Water Sealed"
dgv.Columns(7).Width = 250
dgv.Columns(8).HeaderText = "House Made-Up"
dgv.Columns(8).Width = 230
dgv.Columns(9).HeaderText = "Auto Vehicle"
dgv.Columns(9).Width = 120
dgv.Columns(10).HeaderText = "Business"
dgv.Columns(10).Width = 120
dgv.Columns(11).HeaderText = "Pets"
dgv.Columns(11).Width = 220
dgv.Columns(12).HeaderText = "Family OFW"
dgv.Columns(12).Width = 220
dgv.Columns(13).HeaderText = "Farms"
dgv.Columns(13).Width = 120
dgv.Columns(14).HeaderText = "Family OFW"
dgv.Columns(14).Width = 220
dgv.Columns(15).Visible = False
dgv.Columns(16).HeaderText = "Head Name"
dgv.Columns(16).Width = 220
dgv.Columns(17).HeaderText = "Sex"
dgv.Columns(17).Width = 120
dgv.Columns(18).HeaderText = "Date of Birth"
dgv.Columns(18).Width = 200
dgv.Columns(19).HeaderText = "Age"
dgv.Columns(19).Width = 120
dgv.Columns(20).HeaderText = "Civil Status"
dgv.Columns(20).Width = 120
dgv.Columns(21).HeaderText = "Religion"
dgv.Columns(21).Width = 120
dgv.Columns(22).HeaderText = "Nationality"
dgv.Columns(22).Width = 120
dgv.Columns(23).HeaderText = "Occupation"
dgv.Columns(23).Width = 120
dgv.Columns(24).HeaderText = "Employement"
dgv.Columns(24).Width = 120
End Sub
Sub Formatdgv2()
dgv2.Font = dgFont
dgv2.Columns(0).HeaderText = "Member Type" : dgv2.Columns(0).Width =
130
dgv2.Columns(1).HeaderText = "Member Family" : dgv2.Columns(1).Width =
140
dgv2.Columns(2).HeaderText = "Relationship" : dgv2.Columns(2).Width =
120
dgv2.Columns(3).HeaderText = "Name" : dgv2.Columns(3).Width = 250
dgv2.Columns(4).HeaderText = "Sex" : dgv2.Columns(4).Width = 75
dgv2.Columns(5).HeaderText = "Date of Birth" : dgv2.Columns(5).Width =
120
dgv2.Columns(6).HeaderText = "Age" : dgv2.Columns(6).Width = 75
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

dgv2.Columns(7).HeaderText = "Civil Status" : dgv2.Columns(7).Width =


110
dgv2.Columns(8).HeaderText = "Religion" : dgv2.Columns(8).Width = 180
dgv2.Columns(9).HeaderText = "Nationality" : dgv2.Columns(9).Width =
180
dgv2.Columns(10).HeaderText = "Educational Attainment" :
dgv2.Columns(10).Width = 250
dgv2.Columns(11).HeaderText = "Occupation/Profession" :
dgv2.Columns(11).Width = 250
dgv2.Columns(12).HeaderText = "Current Employment" :
dgv2.Columns(12).Width = 250
dgv2.Columns(13).Visible = False
dgv2.Columns(14).Visible = False

End Sub

Sub MemberRecords()
executeSQLStatement("select * from qryHmembers where HouseNo=" &
Val(txtHouseNos.Text) & " order by ResidentID")
dgv2.DataSource = MyDataSet.Tables(0)
lblMemberCtr.Text = "Household Member(s): " &
MyDataSet.Tables(0).Rows.Count + 1
Formatdgv2()
End Sub

Sub tempMemberRecords()
executeSQLStatement("select * from qryTHmembers where HouseNo=" &
Val(txtHouseNos.Text) & " order by ResidentID")
dgv2.DataSource = MyDataSet.Tables(0)
If Trim(txtHID.Text) <> "" Then
lblMemberCtr.Text = "Household Member(s): " &
MyDataSet.Tables(0).Rows.Count + 1
Else
lblMemberCtr.Text = "Household Member(s): " &
MyDataSet.Tables(0).Rows.Count
End If
''Formatdgv2()
End Sub

Sub ClearH()
txtHouseNos.Clear()
txtZone.Clear() : ComboBox1.Text = ""
txtTSHouses.Clear() : cboTSHouse.Text = ""
txtTSLot.Clear() : cboTSLot.Text = ""
txtWResources.Text = ""
txtAIncome.Clear()
txtNoFmly.Clear()
txtHID.Clear()
txtHName.Clear()
txtHSex.Clear()
txtHDOB.Clear()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txtHAge.Clear()
txtHCivilStatus.Clear()
txtHReligion.Clear()
txtHNationality.Clear()
txtHEduc.Clear()
txtHOcc.Clear()
txtHEmp.Clear()
cmAutoVehicle.Text = ""
cmbElectric.Text = ""
cmbFarm.Text = ""
cmbhmadeup.Text = ""
cmbOFW.Text = ""
cmbpet.Text = ""
cmbwaterseal.Text = ""
txtbusiness.Clear()

End Sub

Sub ClearM()
txtMID.Clear()
txtMFamily.Clear() : cboMFamily.Text = ""
txtMType.Clear()
txtHRelationship.Clear()
txtMName.Clear()
txtMSex.Clear()
txtMDOB.Clear()
txtMAge.Clear()
txtMCivilStatus.Clear()
txtMReligion.Clear()
txtMNationality.Clear()
txtMEduc.Clear()
txtMOcc.Clear()
txtMEmp.Clear()

End Sub

Sub View()
txtHouseNos.ReadOnly = True
ComboBox1.Enabled = False
txtWResources.Enabled = False
txtAIncome.ReadOnly = True
txtNoFmly.ReadOnly = True
cboTSHouse.Enabled = False
cboTSLot.Enabled = False

txtHRelationship.ReadOnly = True
cboMFamily.Enabled = False
rdo1.Enabled = False
rdo2.Enabled = False
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

btnElip1.Enabled = False
btnElip2.Enabled = False
btnAddNew.Enabled = False : btnAddNew.Text = "ADD NEW"
btnUpdate.Enabled = False : btnUpdate.Text = "UPDATE"
btnRemove.Enabled = False : btnRemove.Text = "REMOVE FROM LIST"

btnNew.Enabled = True
btnEdit.Enabled = True
btnDelete.Enabled = True
btnSave.Enabled = False
btnClose.Text = "CLOSE"

txtSearch.ReadOnly = False
dgv.Enabled = True
End Sub

Sub AddEdit()
txtHouseNos.ReadOnly = False
ComboBox1.Enabled = True
txtWResources.Enabled = True
txtAIncome.ReadOnly = False
txtNoFmly.ReadOnly = False
cboTSHouse.Enabled = True
cboTSLot.Enabled = True

btnElip1.Enabled = True
btnAddNew.Enabled = True
btnUpdate.Enabled = True
btnRemove.Enabled = True

btnNew.Enabled = False
btnEdit.Enabled = False
btnDelete.Enabled = False
btnSave.Enabled = True
btnClose.Text = "CANCEL"

txtSearch.ReadOnly = True
dgv.Enabled = False
End Sub

Sub Save()
If txtHouseNos.Text = "" Or cmbwaterseal.Text = "" Or
cmAutoVehicle.Text = "" Or cmbpet.Text = "" Or cmbwaterseal.Text = "" Or
txtZone.Text = "" Or cmbElectric.Text = "" Or txtbusiness.Text = "" Or
cmbOFW.Text = "" Or txtTSHouses.Text = "" Or txtTSLot.Text = "" Then
MsgBox("Required fields missing!", MsgBoxStyle.Information,
"Missing Information")
Exit Sub
End If
If AEswitch = "a" Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

kom = New OleDbCommand


kom.Connection = kon
kom.CommandText = "insert into tblHouseHold ([HouseNo],
[ResidentID],[Electric],[WaterSealled],[MadeHouse],[AutoVehicle],[Business],
[Pets],[FamilyOFW],[WaterStyle],[Farms],[numberofFamily],[Zone],[thouse],
[tlot]) values (" & txtHouseNos.Text & "," & txtHID.Text & ",'" &
cmbElectric.Text & "','" & cmbwaterseal.Text & "','" & cmbhmadeup.Text & "','"
& cmAutoVehicle.Text & "','" & txtbusiness.Text & "','" & cmbpet.Text & "','"
& cmbOFW.Text & "','" & txtWResources.Text & "','" & cmbFarm.Text & "','" &
txtNoFmly.Text & "','" & txtZone.Text & "','" & txtTSHouses.Text & "','" &
txtTSLot.Text & "')"
kom.ExecuteNonQuery()
executeSQLStatement("delete * from tblHmembers where HouseNo=" &
Val(txtHouseNos.Text) & "")
executeSQLStatement("insert into
tblHmembers(HouseNo,ResidentID,Relationship,MemberFamily,MemberType) select
HouseNo,ResidentID,Relationship,MemberFamily,MemberType from tempHmembers")
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
ReloadRecords()
MemberRecords()
View()
Else
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "update tblHouseHold set [HouseNo]=" &
txtHouseNos.Text & ", [ResidentID]=" & txtHID.Text & ", [Electric]='" &
cmbElectric.Text & "', [WaterSealled]='" & cmbwaterseal.Text & "',
[MadeHouse]='" & cmbhmadeup.Text & "', [AutoVehicle]='" & cmAutoVehicle.Text &
"', [Business]='" & txtbusiness.Text & "', [Pets]='" & cmbpet.Text & "',
[FamilyOFW]='" & cmbOFW.Text & "', [WaterStyle]='" & txtWResources.Text & "',
[Farms]='" & cmbFarm.Text & "', [numberofFamily]='" & txtNoFmly.Text & "',
[Zone]='" & txtZone.Text & "', thouse='" & txtTSHouses.Text & "', [tlot]='" &
txtTSLot.Text & "' where[ResidentID]=" & txtHID.Text & ""
kom.ExecuteNonQuery()
executeSQLStatement("delete * from tblHmembers where HouseNo=" &
Val(txtHouseNos.Text) & "")
executeSQLStatement("insert into
tblHmembers(HouseNo,ResidentID,Relationship,MemberFamily,MemberType) select
HouseNo,ResidentID,Relationship,MemberFamily,MemberType from tempHmembers")
MsgBox("Record updated", MsgBoxStyle.Information, "Updated")
ReloadRecords()
MemberRecords()
View()
End If
End Sub

Private Sub btnElip1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnElip1.Click
SelectSwitch = 1
frmSearchRecords.ShowDialog()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End Sub

Private Sub btnElip2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnElip2.Click
SelectSwitch = 2
frmSearchRecords.ShowDialog()
End Sub

Private Sub btnAddNew_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnAddNew.Click
If btnAddNew.Text = "ADD NEW" Then
If Trim(txtHouseNos.Text) = "" Then
MsgBox("Please fill-up Household Information first!",
MsgBoxStyle.Information, "Missing Information")
Exit Sub
End If
txtHRelationship.ReadOnly = False
cboMFamily.Enabled = True
rdo1.Enabled = True
rdo2.Enabled = True
btnAddNew.Enabled = False
btnUpdate.Text = "CANCEL"
btnRemove.Text = "ADD TO LIST"
btnElip2.Enabled = True
ClearM()
Else
executeSQLStatement("update tempHmembers set Relationship='" &
Trim(txtHRelationship.Text) & "',MemberType='" & Trim(txtMType.Text) &
"',MemberFamily='" & Trim(txtMFamily.Text) & "' where ResidentID=" & memid & "
and HouseNo=" & Val(txtCode.Text) & "")
MsgBox("Household member information updated",
MsgBoxStyle.Information, "Updated")
tempMemberRecords()
txtHRelationship.ReadOnly = True
cboMFamily.Enabled = False
rdo1.Enabled = False
rdo2.Enabled = False
btnAddNew.Text = "ADD NEW"
btnUpdate.Text = "UPDATE"
btnRemove.Enabled = True
End If
End Sub

Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnUpdate.Click
If btnUpdate.Text = "UPDATE" Then
If Trim(txtMID.Text) = "" Then
MsgBox("No record selected", MsgBoxStyle.Information, "Select
Record")
Exit Sub
End If
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

cboMFamily.Text = ""
txtHRelationship.ReadOnly = False
cboMFamily.Enabled = True
rdo1.Enabled = True
rdo2.Enabled = True
btnAddNew.Text = "SAVE"
btnUpdate.Text = "CANCEL"
btnRemove.Enabled = False
btnElip2.Enabled = True
Else
ClearM()
txtHRelationship.ReadOnly = True
cboMFamily.Enabled = False
rdo1.Enabled = False
rdo2.Enabled = False
btnAddNew.Enabled = True
btnAddNew.Text = "ADD NEW"
btnUpdate.Text = "UPDATE"
btnRemove.Text = "REMOVE FROM LIST"
btnRemove.Enabled = True
btnElip2.Enabled = False
End If
End Sub

Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnRemove.Click
If btnRemove.Text = "REMOVE FROM LIST" Then
If Trim(txtMID.Text) = "" Then
MsgBox("No record selected", MsgBoxStyle.Information, "Select
Record")
Exit Sub
Else

executeSQLStatement("delete from tempHmembers WHERE


ResidentID='" & memid & "'")
'MsgBox(txtHID.Text)
tempMemberRecords()
MsgBox("Household member removed from list",
MsgBoxStyle.Information, "Removed")
ClearM()
End If
Else
executeSQLStatement("insert into tempHmembers values(" &
Val(txtHouseNos.Text) & ",'" & Trim(txtMID.Text) & "','" &
Trim(txtHRelationship.Text) & "','" & Trim(txtMFamily.Text) & "','" &
Trim(txtMType.Text) & "')")
tempMemberRecords()
MsgBox("New household member added to list",
MsgBoxStyle.Information, "Added")
txtHRelationship.ReadOnly = True
cboMFamily.Enabled = False
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

rdo1.Enabled = False
rdo2.Enabled = False
btnAddNew.Enabled = True
btnAddNew.Text = "ADD NEW"
btnUpdate.Text = "UPDATE"
btnRemove.Text = "REMOVE FROM LIST"
btnElip2.Enabled = False
End If
End Sub

Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnNew.Click
AEswitch = "a"
AddEdit()
ClearH()
ClearM()
executeSQLStatement("delete from tempHmembers")
tempMemberRecords()
End Sub

Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEdit.Click
AEswitch = "e"
AddEdit()
executeSQLStatement("delete from tempHmembers")
executeSQLStatement("insert into
tempHmembers(HouseNo,ResidentID,Relationship,MemberFamily,MemberType) select
HouseNo,ResidentID,Relationship,MemberFamily,MemberType from tblHmembers where
HouseNo=" & Val(txtHouseNos.Text) & "")
tempMemberRecords()
End Sub

Function archive()
If Trim(txtHouseNos.Text) <> "" Then
If MsgBox("Do you want to move this record to archives?",
MsgBoxStyle.Question + MsgBoxStyle.YesNo, "System Message") = MsgBoxResult.Yes
Then
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblhHarchive ([HouseNo],
[ResidentID],[Electric],[WaterSealled],[MadeHouse],[AutoVehicle],[Business],
[Pets],[FamilyOFW],[WaterStyle],[Farms],[numberofFamily],[Zone],[thouse],
[tlot]) values (" & txtHouseNos.Text & "," & txtHID.Text & ",'" &
cmbElectric.Text & "','" & cmbwaterseal.Text & "','" & cmbhmadeup.Text & "','"
& cmAutoVehicle.Text & "','" & txtbusiness.Text & "','" & cmbpet.Text & "','"
& cmbOFW.Text & "','" & txtWResources.Text & "','" & cmbFarm.Text & "','" &
txtNoFmly.Text & "','" & txtZone.Text & "','" & txtTSHouses.Text & "','" &
txtTSLot.Text & "')"
kom.ExecuteNonQuery()
kom.CommandText = "Delete * from tblHouseHold where HouseNo="
& txtHouseNos.Text
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

kom.ExecuteNonQuery()
Call ClearH()
Call ClearM()
'Call FilldgHouseholds()
MsgBox("Record moved to archives", MsgBoxStyle.Information,
"System Message")
End If
Else
MsgBox("No record selected", MsgBoxStyle.Information, "System
Message")
End If
Return True
End Function
'Function FilldgHouseholds()
' sql = "select * from tblHousehold order by HouseNo"
' da = New OleDbDataAdapter(sql, kon)
' ds = New DataSet
' da.Fill(ds, "Household")
' dgv.DataSource = ds.Tables("Household")
' lblRecFound.Text = "Record(s) found: " &
ds.Tables("Households").Rows.Count
' 'Call Formatdgv()
' Return True
'End Function
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
Save()
End Sub

Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnClose.Click
If btnClose.Text = "CLOSE" Then
Me.Close()
Else
ClearH()
ClearM()
MemberRecords()
View()
End If
End Sub

Private Sub dgv_CellClick(ByVal sender As Object, ByVal e As


System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv.CellClick
txtCode.Text = dgv.CurrentRow.Cells(0).Value.ToString
txtHouseNos.Text = dgv.CurrentRow.Cells(0).Value.ToString
txtZone.Text = dgv.CurrentRow.Cells(1).Value.ToString
txtTSHouses.Text = dgv.CurrentRow.Cells(2).Value.ToString
txtTSLot.Text = dgv.CurrentRow.Cells(3).Value.ToString
txtWResources.Text = dgv.CurrentRow.Cells(4).Value.ToString
cmbElectric.Text = dgv.CurrentRow.Cells(6).Value.ToString
txtNoFmly.Text = dgv.CurrentRow.Cells(5).Value.ToString
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

cmbwaterseal.Text = dgv.CurrentRow.Cells(7).Value.ToString
cmbhmadeup.Text = dgv.CurrentRow.Cells(8).Value.ToString
txtHID.Text = dgv.CurrentRow.Cells(14).Value.ToString
HID = txtHID.Text
txtHName.Text = dgv.CurrentRow.Cells(15).Value.ToString
cmAutoVehicle.Text = dgv.CurrentRow.Cells(9).Value.ToString
txtbusiness.Text = dgv.CurrentRow.Cells(10).Value.ToString()
txtHDOB.Text =
Date.Parse(dgv.CurrentRow.Cells(17).Value.ToString).ToString("M'/'d'/'yyyy")
cmbpet.Text = dgv.CurrentRow.Cells(11).Value.ToString
cmbOFW.Text = dgv.CurrentRow.Cells(12).Value.ToString
cmbFarm.Text = dgv.CurrentRow.Cells(13).Value.ToString
txtHSex.Text = dgv.CurrentRow.Cells(16).Value.ToString
txtHAge.Text = dgv.CurrentRow.Cells(18).Value.ToString
txtHCivilStatus.Text = dgv.CurrentRow.Cells(19).Value.ToString
txtHReligion.Text = dgv.CurrentRow.Cells(20).Value.ToString
txtHNationality.Text = dgv.CurrentRow.Cells(21).Value.ToString
txtHEduc.Text = dgv.CurrentRow.Cells(22).Value.ToString
txtHOcc.Text = dgv.CurrentRow.Cells(23).Value.ToString
txtHEmp.Text = dgv.CurrentRow.Cells(24).Value.ToString
txtname.Text = txtHName.Text
MemberRecords()
End Sub

Private Sub dgv2_CellClick(ByVal sender As Object, ByVal e As


System.Windows.Forms.DataGridViewCellEventArgs)

End Sub

Private Sub cboZone_TextChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles ComboBox1.TextChanged
txtZone.Text = ComboBox1.Text
End Sub

Private Sub cboTSHouse_TextChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles cboTSHouse.TextChanged
txtTSHouses.Text = cboTSHouse.Text
End Sub

Private Sub cboTSLot_TextChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles cboTSLot.TextChanged
txtTSLot.Text = cboTSLot.Text
End Sub
Private Sub cboMFamily_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cboMFamily.TextChanged
txtMFamily.Text = cboMFamily.Text
End Sub

Private Sub txtHouseNo_KeyDown(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles txtHouseNos.KeyDown
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End Sub

Private Sub txtHouseNo_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtHouseNos.KeyPress

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String = "1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtHouseNo_LostFocus(ByVal sender As Object, ByVal e As


System.EventArgs) Handles txtHouseNos.LostFocus
If btnClose.Text = "CANCEL" Then
If AEswitch = "a" Then
executeSQLStatement("select * from tblHousehold where
HouseNo=" & Val(txtHouseNos.Text) & "")
If MyDataSet.Tables(0).Rows.Count <> 0 Then
MsgBox("House No. already exists!",
MsgBoxStyle.Information, "Record Exists")
txtHouseNos.Clear()
Exit Sub
End If
Else
executeSQLStatement("select * from tblHousehold where
HouseNo=" & Val(txtHouseNos.Text) & " and HouseNo<>" & Val(txtCode.Text) & "")
If MyDataSet.Tables(0).Rows.Count <> 0 Then
MsgBox("House No. already exists!",
MsgBoxStyle.Information, "Record Exists")
txtHouseNos.Text = txtCode.Text
Exit Sub
End If
End If
End If
End Sub

Private Sub txtNoFmly_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtNoFmly.KeyPress

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String = "1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Private Sub txtNoFmly_TextChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles txtNoFmly.TextChanged
If Trim(txtNoFmly.Text) = "" Then
Exit Sub
End If

cboMFamily.Items.Clear()

If Val(txtNoFmly.Text) = 1 Then
cboMFamily.Items.Add("1st family")
ElseIf Val(txtNoFmly.Text) = 2 Then
cboMFamily.Items.Add("1st family")
cboMFamily.Items.Add("2nd family")
ElseIf Val(txtNoFmly.Text) = 3 Then
cboMFamily.Items.Add("1st family")
cboMFamily.Items.Add("2nd family")
cboMFamily.Items.Add("3rd family")
ElseIf Val(txtNoFmly.Text) >= 4 Then
cboMFamily.Items.Add("1st family")
cboMFamily.Items.Add("2nd family")
cboMFamily.Items.Add("3rd family")
Dim x As Integer
Dim y As String
For x = 4 To Val(txtNoFmly.Text)
y = x & "th family"
cboMFamily.Items.Add(y)
Next
End If
End Sub

Private Sub rdo1_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles rdo1.CheckedChanged
If rdo1.Checked = True Then
If btnClose.Text = "CANCEL" Then
If Val(txtNoFmly.Text) = 1 Then
MsgBox("There can only be one head of the family. The Head
of Household is the head of the first family", MsgBoxStyle.Information,
"System Message")
rdo1.Checked = False
Exit Sub
End If
If Val(txtNoFmly.Text) > 1 And Trim(txtMFamily.Text) = "1st
family" Then
MsgBox("There can only be one head of the family. The Head
of Household is the head of the first family", MsgBoxStyle.Information,
"System Message")
rdo1.Checked = False
Exit Sub
End If
If Val(txtNoFmly.Text) > 1 Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

executeSQLStatement("select * from qryTHmembers where


MemberFamily='" & Trim(txtMFamily.Text) & "' and MemberFamily<>'1st family'
and MemberType='" & Trim(rdo1.Text) & "'")
If MyDataSet.Tables(0).Rows.Count > 1 Then
MsgBox("There can only be one head of the family.",
MsgBoxStyle.Information, "System Message")
rdo1.Checked = False
Exit Sub
End If
End If
End If
txtMType.Text = rdo1.Text
End If
End Sub

Private Sub rdo2_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles rdo2.CheckedChanged
If rdo2.Checked = True Then
txtMType.Text = rdo2.Text
End If
End Sub

Private Sub txtMType_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txtMType.TextChanged
If Trim(txtMType.Text) = rdo1.Text Then
rdo1.Checked = True
ElseIf Trim(txtMType.Text) = rdo2.Text Then
rdo2.Checked = True
Else
rdo1.Checked = False
rdo2.Checked = False
End If
End Sub

Private Sub btnselect_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs)
Me.Close()
End Sub

Private Sub dgv2_CellContentClick(ByVal sender As System.Object, ByVal e


As System.Windows.Forms.DataGridViewCellEventArgs)

End Sub

Private Sub txtAIncome_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtAIncome.KeyPress

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String = "1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

e.Handled = True
End If
End If
End Sub

Private Sub txtAIncome_TextChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles txtAIncome.TextChanged

End Sub

Private Sub txtHRelationship_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtHRelationship.KeyPress
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtHRelationship_TextChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles txtHRelationship.TextChanged

End Sub

Private Sub txtSearch_TextChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles txtSearch.TextChanged

Search()
End Sub
Sub Search()
Call LoadRecord(dt, dset, "qryHouseHolds1", "Select * from
qryHouseHolds1 Where HouseNo like '%" & txtSearch.Text & "%'", dgv)
lblRecFound.Text = dset.Tables("qryHouseholds1").Rows.Count & "
Record(s) found!"
End Sub
Sub ReloadRecords1()
executeSQLStatement("select * from qryHouseHolds1 order by HeadName")
dgv.DataSource = MyDataSet.Tables(0)
lblRecFound.Text = "Record(s) found: " &
MyDataSet.Tables(0).Rows.Count
'Formatdgv()
End Sub

Private Sub tab1_Click(sender As Object, e As EventArgs)

End Sub

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


btnHI.Click
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

panelHMI.Visible = False
panelHI.Visible = True
panelLHM.Visible = False
End Sub

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


btnHMI.Click
panelHMI.Visible = True
panelHI.Visible = False
panelLHM.Visible = False
End Sub

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


btnLHM.Click
panelHMI.Visible = False
panelLHM.Visible = True
panelHI.Visible = False
End Sub
Private Sub btndelete_Click_1(sender As Object, e As EventArgs) Handles
btndelete.Click
Call archive()
End Sub

Private Sub dgv2_CellClick_1(sender As Object, e As


DataGridViewCellEventArgs) Handles dgv2.CellClick
txtMType.Text = dgv2.CurrentRow.Cells(0).Value.ToString
txtMFamily.Text = dgv2.CurrentRow.Cells(1).Value.ToString
txtHRelationship.Text = dgv2.CurrentRow.Cells(2).Value.ToString
txtMName.Text = dgv2.CurrentRow.Cells(3).Value.ToString
txtMSex.Text = dgv2.CurrentRow.Cells(4).Value.ToString
txtMDOB.Text =
Date.Parse(dgv2.CurrentRow.Cells(5).Value.ToString).ToString("M'/'d'/'yyyy")
txtMAge.Text = dgv2.CurrentRow.Cells(6).Value.ToString
txtMCivilStatus.Text = dgv2.CurrentRow.Cells(7).Value.ToString
txtMReligion.Text = dgv2.CurrentRow.Cells(8).Value.ToString
txtMNationality.Text = dgv2.CurrentRow.Cells(9).Value.ToString
txtMEduc.Text = dgv2.CurrentRow.Cells(10).Value.ToString
txtMOcc.Text = dgv2.CurrentRow.Cells(11).Value.ToString
txtMEmp.Text = dgv2.CurrentRow.Cells(12).Value.ToString
txtMID.Text = dgv2.CurrentRow.Cells(13).Value.ToString
memid = dgv2.CurrentRow.Cells(14).Value.ToString
txtname.Text = dgv2.CurrentRow.Cells(3).Value.ToString
MID = txtMID.Text
txtname.Text = txtMName.Text
End Sub

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


Handles txtSearch.KeyPress
If Not (Asc(e.KeyChar)) = 8 Then
Dim allowchar As String =
"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub
End Class
“list of data
Imports System.Data.OleDb
Public Class FrmListofResident
Dim dt As New OleDbDataAdapter
Dim dtset As DataSet
Dim kom As New OleDbCommand
Dim dgFont As New Font("Cambria", 10)
Private Sub btnclose_Click(sender As Object, e As EventArgs) Handles
btnclose.Click
Close()
End Sub
Sub formatgrid()
dgvlist.Font = dgFont
dgvlist.Columns(0).Visible = False
dgvlist.Columns(1).HeaderText = "Last Name"
dgvlist.Columns(1).Width = 120
dgvlist.Columns(2).HeaderText = "First Name"
dgvlist.Columns(2).Width = 120
dgvlist.Columns(3).HeaderText = "Last Name"
dgvlist.Columns(3).Width = 120
dgvlist.Columns(4).HeaderText = "Zone"
dgvlist.Columns(4).Width = 120
dgvlist.Columns(5).HeaderText = "Sex"
dgvlist.Columns(5).Width = 120
dgvlist.Columns(6).HeaderText = "Date of Birth"
dgvlist.Columns(6).Width = 120
dgvlist.Columns(7).HeaderText = "Age"
dgvlist.Columns(7).Width = 120
dgvlist.Columns(8).HeaderText = "Status"
dgvlist.Columns(8).Width = 120
dgvlist.Columns(9).HeaderText = "Religion"
dgvlist.Columns(9).Width = 100
dgvlist.Columns(10).HeaderText = "Nationality"
dgvlist.Columns(10).Width = 120
dgvlist.Columns(11).HeaderText = "Educational Attaintment"
dgvlist.Columns(11).Width = 220
dgvlist.Columns(12).HeaderText = "Occupation"
dgvlist.Columns(12).Width = 120
dgvlist.Columns(13).HeaderText = "Employement"
dgvlist.Columns(13).Width = 120
End Sub
Private Sub FrmListofResident_Load(sender As Object, e As EventArgs)
Handles MyBase.Load
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Call populate()
Call konneksyon()
End Sub
Sub populate()
Select Case Trim(Me.Text)
Case "PWD"
lblist.Text = "Person with Disability"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents Where PWD='Yes'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case "4ps"
lblist.Text = "Member of Pantawid Pamilya Fund"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents Where PPF='Yes'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case "Browse"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case "ResidentList"
lblist.Text = "San Esteban Resident list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case "Male"
lblist.Text = "San Esteban Male list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents where rSex='Male'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case "female"
lblist.Text = "San Esteban Female list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents where rSex='Female'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case "Senior"
lblist.Text = "San Esteban Senior Citizen list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents where rAge>=60", dgvlist)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

lblcount.Text = dtset.Tables("tblResidents").Rows.Count &


"Records found!"
formatgrid()
Case 1
lblist.Text = "Zone 1 resident list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents where rZone='Zone 1'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case 2
lblist.Text = "Zone 2 resident list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents Where rZone='Zone 2'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case 3
lblist.Text = "Zone 3 resident list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents Where rZone='Zone 3'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case 4
lblist.Text = "Zone 4 resident list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents Where rZone='Zone 4'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case 5
lblist.Text = "Zone 5 resident list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents Where rZone='Zone 5'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case 6
lblist.Text = "Zone 6 resident list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents Where rZone='Zone 6'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
formatgrid()
Case 7
lblist.Text = "Zone 7 resident list"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents Where rZone='Zone 7'", dgvlist)
lblcount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

formatgrid()
End Select
End Sub

Private Sub dgvlist_CellClick(sender As Object, e As


DataGridViewCellEventArgs) Handles dgvlist.CellClick
'frmindigent.txtfullname.Text = dgvlist.CurrentRow.Cells(1).Value +
dgvlist.CurrentRow.Cells(2).Value + dgvlist.CurrentRow.Cells(3).Value
'Me.Close()
End Sub

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


btnprint.Click
print()
End Sub
Sub print()
Select Case Trim(Me.Text)
Case "4ps"
Call konneksyon()
Dim pwds As New cry4ps
dt = New OleDbDataAdapter("Select * from tblResidents ORDER By
rLN ", kon)
dtset = New DataSet
dt.Fill(dtset)
pwds.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = pwds
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case "PWD"
Call konneksyon()
Dim pwd As New crPWD
dt = New OleDbDataAdapter("Select * from tblResidents ORDER By
rLN ", kon)
dtset = New DataSet
dt.Fill(dtset)
pwd.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = pwd
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case "ResidentList"
Call konneksyon()
Dim resident As New crResident
dt = New OleDbDataAdapter("Select * from tblResidents ORDER By
rLN ", kon)
dtset = New DataSet
dt.Fill(dtset)
resident.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = resident
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Case "Male"
Call konneksyon()
Dim male As New crmale
dt = New OleDbDataAdapter("Select * from tblResidents where
rSex='male' ", kon)
dtset = New DataSet
dt.Fill(dtset)
male.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = male
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case "female"
Call konneksyon()
Dim female As New crFemale
dt = New OleDbDataAdapter("Select * from tblResidents where
rSex='female' ", kon)
dtset = New DataSet
dt.Fill(dtset)
female.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = female
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case "Senior"
Call konneksyon()
Dim Senior As New crSenior
dt = New OleDbDataAdapter("Select * from tblResidents where
rAge>=60 ", kon)
dtset = New DataSet
dt.Fill(dtset)
Senior.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = Senior
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 1
Call konneksyon()
Dim zone1 As New crzone1
dt = New OleDbDataAdapter("Select * from tblResidents where
rZone='Zone 1'", kon)
dtset = New DataSet
dt.Fill(dtset)
zone1.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone1
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 2
Call konneksyon()
Dim zone1 As New crzone2
dt = New OleDbDataAdapter("Select * from tblResidents where
rZone='Zone 2'", kon)
dtset = New DataSet
dt.Fill(dtset)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

zone1.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone1
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 3
Call konneksyon()
Dim zone1 As New crZone3
dt = New OleDbDataAdapter("Select * from tblResidents where
rZone='Zone 3'", kon)
dtset = New DataSet
dt.Fill(dtset)
zone1.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone1
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 4
Call konneksyon()
Dim zone1 As New crzone4
dt = New OleDbDataAdapter("Select * from tblResidents where
rZone='Zone 4'", kon)
dtset = New DataSet
dt.Fill(dtset)
zone1.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone1
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 5
Call konneksyon()
Dim zone1 As New crzone4
dt = New OleDbDataAdapter("Select * from tblResidents where
rZone='Zone 5'", kon)
dtset = New DataSet
dt.Fill(dtset)
zone1.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone1
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 6
Call konneksyon()
Dim zone1 As New crZone6
dt = New OleDbDataAdapter("Select * from tblResidents where
rZone='Zone 6'", kon)
dtset = New DataSet
dt.Fill(dtset)
zone1.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone1
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
Case 7
Call konneksyon()
Dim zone1 As New crZone7
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

dt = New OleDbDataAdapter("Select * from tblResidents where


rZone='Zone 7'", kon)
dtset = New DataSet
dt.Fill(dtset)
zone1.SetDataSource(dtset.Tables("tblResidents"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone1
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.Show()
End Select
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs)

End Sub
End Class

“under security
Imports System.Data.OleDb
Public Class frmLogin
Dim uname, pword As String
Dim x, m, s As Integer
Private Sub Login_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call konneksyon()
lblAttempts.Text = ""
Call CheckSystemLock()
txtUName.Focus()
frmMain.tmrMain.Start()
Me.Text = "Login Form"
End Sub

Protected Overrides ReadOnly Property CreateParams() As


System.Windows.Forms.CreateParams
'to disable the alt+f4
Get
Dim cp As CreateParams = MyBase.CreateParams
Const CS_NOCLOSE As Integer = &H200
cp.ClassStyle = cp.ClassStyle Or CS_NOCLOSE
Return cp
End Get
End Property

Function Login()
'to check if the log-in information entered is valid
If Trim(txtUName.Text) <> "" And Trim(txtPword.Text) <> "" Then
sql = "select * from tblSecurity where UName='" & txtUName.Text &
"' and Pword='" & txtPword.Text & "'"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

da = New OleDbDataAdapter(sql, kon)


ds = New DataSet
da.Fill(ds, "Security")
If ds.Tables("Security").Rows.Count <> 0 Then
uname = ds.Tables("Security").Rows(0).Item("UName").ToString
pword = ds.Tables("Security").Rows(0).Item("Pword").ToString
End If
If txtUName.Text.Equals(uname) And txtPword.Text.Equals(pword)
Then
frmMain.lblaccess.Text =
ds.Tables("Security").Rows(0).Item("AccType").ToString
frmMain.Label23.Text =
ds.Tables("Security").Rows(0).Item("FName").ToString
frmMain.Label23.Text = txtUName.Text
Call Log()
frmMain.Show() : Me.Hide()
Else
x = x - 1
If x = 1 Then
lblAttempts.Text = "Warning! You have " & x & " attempt
left to Log-in"
MsgBox("Access Denied. Invalid Username/Password. Warning!
You have 1 attempt left to Log-in. System will be locked.",
MsgBoxStyle.Information, "System Message")
ElseIf x = 0 Then
Call LockSystem()
MsgBox("System has been locked due to Security Risk",
MsgBoxStyle.Critical, "System Message")
Else
lblAttempts.Text = "You have " & x & " attempts left to
Log-in"
MsgBox("Access Denied. Invalid Username/Password.",
MsgBoxStyle.Information, "System Message")
End If
End If
ElseIf Trim(txtUName.Text) = "" And Trim(txtPword.Text) = "" Then
MsgBox("Empty Entries not allowed. Please fill-up the fields.",
MsgBoxStyle.Information, "System Message")
Else
x = x - 1
If x = 1 Then
lblAttempts.Text = "You have " & x & " attempt left to Log-in"
MsgBox("Access Denied. Empty Entry not Allowed. Warning! You
have 1 Attempt left. System will be locked", MsgBoxStyle.Exclamation, "Login
Failed")
ElseIf x = 0 Then
Call LockSystem()
MsgBox("System has been locked due to Security Risk",
MsgBoxStyle.Critical, "System Message")
Else
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

lblAttempts.Text = "You have " & x & " attempts left to Log-
in"
MsgBox("Access Denied. Empty Entry not Allowed",
MsgBoxStyle.Exclamation, "Login Failed")
End If
End If
Return True
End Function

Function CheckSystemLock()
'checks if the system is still locked or not
sql = "Select * from LockTime"
da = New OleDbDataAdapter(sql, kon)
ds = New DataSet
da.Fill(ds, "LockTime")
If ds.Tables("LockTime").Rows.Count <> 0 Then
LoginTimer.Start()
m =
Val(ds.Tables("LockTime").Rows(0).Item("MinutesLeft").ToString)
s =
Val(ds.Tables("LockTime").Rows(0).Item("SecondsLeft").ToString)
grpLogin.Enabled = False
lblForgotPassword.Text = "Administrator Unlock"
Else
LoginTimer.Stop()
x = 5 : lblAttempts.Text = "You have " & x & " attempts to Log-in"
grpLogin.Enabled = True
lblForgotPassword.Text = "Forgot your password?"
End If
Return True
End Function

Function LockSystem()
'locks the system and save the locktime to the database
sql = "select * from SetLockTime"
da = New OleDbDataAdapter(sql, kon)
ds = New DataSet
da.Fill(ds, "SetLockTime")
m = ds.Tables("SetLockTime").Rows(0).Item("Minutes").ToString
s = ds.Tables("SetLockTime").Rows(0).Item("Seconds").ToString
sql = "insert into LockTime values('" & m & "','" & s & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
txtUName.Clear()
txtPword.Clear()
LoginTimer.Start()
grpLogin.Enabled = False
lblForgotPassword.Text = "Administrator Unlock"
lblAttempts.Text = "System Unlocks in " & m & ":" & "0" & s
Return True
End Function
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String

act = "System Log-in"

sql = "insert into tblSystemLog values('" & txtUName.Text & "','" &
act & "','" & currDate & "','" & currTime & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
Return True
End Function

Function UnlockSystem()
'unlocks the system when timer reaches zero
If s = 0 Then
m = m - 1
s = 60
End If
s = s - 1
If s > 9 Then
lblAttempts.Text = "System Unlocks in " & m & ":" & s
Else
lblAttempts.Text = "System Unlocks in " & m & ":" & "0" & s
End If

sql = "Update LockTime set MinutesLeft='" & m & "',SecondsLeft='" & s


& "'"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()

If m = 0 And s = 0 Then
lblAttempts.Text = "System Unlocks in " & m & ":" & "0" & s
LoginTimer.Stop()
grpLogin.Enabled = True
lblForgotPassword.Text = "Forgot your password?"
x = 5 : lblAttempts.Text = "You have " & x & " attempts to Log-in"

sql = "delete * from LockTime"


cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
End If
Return True
End Function

Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnLogin.Click
Call Login()
End Sub
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnExit.Click
Application.Exit()
End Sub

Private Sub LoginTimer_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles LoginTimer.Tick
Call UnlockSystem()
End Sub

Private Sub lblForgotPassword_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles lblForgotPassword.Click
If lblForgotPassword.Text = "Forgot your password?" Then
frmEnterUserName.ShowDialog()
Else
If MsgBox("Do you want to unlock the system using an Administrator
account?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "System Message") =
MsgBoxResult.Yes Then
AdminUnlock.ShowDialog()
End If
End If
End Sub

Private Sub lblForgotPword_MouseHover(ByVal sender As Object, ByVal e As


System.EventArgs) Handles lblForgotPassword.MouseHover
lblForgotPassword.ForeColor = Color.Blue
lblForgotPassword.Font = New Font(lblForgotPassword.Font,
FontStyle.Underline + FontStyle.Italic + FontStyle.Bold)
End Sub

Private Sub lblForgotPword_MouseLeave(ByVal sender As Object, ByVal e As


System.EventArgs) Handles lblForgotPassword.MouseLeave
lblForgotPassword.ForeColor = Color.Black
lblForgotPassword.Font = New Font(lblForgotPassword.Font,
FontStyle.Italic + FontStyle.Bold)
End Sub

Private Sub txtUName_TextChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles txtUName.TextChanged

End Sub

Private Sub txtPword_TextChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles txtPword.TextChanged

End Sub

Private Sub lblUName_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs)
txtUName.Focus()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End Sub

Private Sub lblPword_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs)
txtPword.Focus()
End Sub

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


grpLogin.Enter

End Sub

Private Sub txtUName_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtUName.KeyPress
If Asc(e.KeyChar) = 13 Then
txtPword.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtPword_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtPword.KeyPress
If Asc(e.KeyChar) = 13 Then
btnLogin.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub pnlLogin_Paint(ByVal sender As System.Object, ByVal e As


System.Windows.Forms.PaintEventArgs)

End Sub
End Class
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

“for add migrated


Imports System.Data.OleDb
Public Class frmMigrate
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet
Private Sub btnBrowse_Click(sender As Object, e As EventArgs) Handles
btnBrowse.Click
Dim frm As New FrmSearchRecord1
frm.Text = "Migrated Person"
frm.ShowDialog()
End Sub

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


btnsave.Click
saveRecord()
End Sub
Sub saveRecord()
If txtfuname.Text = "" Or txtage.Text = "" Or cmbcivil.Text = "" Or
cmbdate.Text = "" Or cmbsex.Text = "" Or cmbzone.Text = "" Or
DateTimePicker1.Text = "" Then
MsgBox("Cannot save. Required field missing!",
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Empty fields")
Exit Sub
End If
If Me.Text = "Add Migrated Person" Then
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblMigrated
(fullName,rZone,rSex,rDOB,rAge,rCstatus,DateMigrated) values ('" &
txtfuname.Text & "','" & cmbzone.Text & "','" & cmbsex.Text & "','" &
cmbdate.Text & "'," & txtage.Text & ",'" & cmbcivil.Text & "','" &
DateTimePicker1.Text & "')"
kom.ExecuteNonQuery()
kom.CommandText = "Delete * from tblresidents where ResidentID="
& txtID.Text
kom.ExecuteNonQuery()
Call frmRecord.pupulate()
MsgBox("Record Succesfully added!", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Add Record")
Me.Close()
Else
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "update [tblMigrated] set [fullName]='" &
txtfuname.Text & "', [rZone]='" & cmbzone.Text & "',[rSex]='" & cmbsex.Text &
"', [rDOB]='" & cmbdate.Text & "', [rAge]=" & txtage.Text & ",[rCstatus]='" &
cmbcivil.Text & "',[DateMigrated]='" & DateTimePicker1.Text & "' Where
[ResidentID]=" & txtIDs.Text & ""
kom.ExecuteNonQuery()
MsgBox("Record Updated!", MsgBoxStyle.Information, "Saved")
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Me.Close()
End If
End Sub
End Class

“record list of data


Imports System.Data.OleDb
Public Class frmRecord
Dim dt As New OleDbDataAdapter
Dim dtset As DataSet
Dim kom As New OleDbCommand
Dim dreport As New OleDbDataAdapter
Dim dsreport As New DataSet
Dim dgFont As New Font("Cambria", 10)
Sub pupulate()
Select Case Trim(Me.Text)
Case "Residents"

Call LoadRecord(dt, dtset, "tblResidents", "Select * from


tblResidents ORDER BY rLN ASC", DataGridView1)
lblCount.Text = dtset.Tables("tblResidents").Rows.Count & " "
+ "Records found!"
Call formatgrid()
Case "Indigent"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents ORDER BY rLN", DataGridView1)
lblCount.Text = dtset.Tables("tblResidents").Rows.Count & " "
+ "Records found!"
Case "Security"
Call LoadRecord(dt, dtset, "tblSecurity", "Select * from
tblSecurity", DataGridView1)
lblCount.Text = dtset.Tables("tblSecurity").Rows.Count & " " +
"Records found!"
Call formatgrid()
Case "Officials"
Call LoadRecord(dt, dtset, "qryOfficials", "Select * from
qryOfficials ORDER BY rLN ASC", DataGridView1)
lblCount.Text = dtset.Tables("qryOfficials").Rows.Count & " "
+ "Records found!"
Call formatgrid()
Case "HouseHold"
Call LoadRecord(dt, dtset, "qryHouseHold", "Select * from
qryHouseHold", DataGridView1)
lblCount.Text = dtset.Tables("qryHouseHold").Rows.Count & " "
+ "Records found!"
Call formatgrid()
Case "Projects"
Call LoadRecord(dt, dtset, "tblProject", "Select * from
tblProject", DataGridView1)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

lblCount.Text = dtset.Tables("tblProject").Rows.Count & " " +


"Records found!"
Call formatgrid()
Case "SeniorCitizen"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents Where rAge>=60", DataGridView1)
lblCount.Text = dtset.Tables("tblResidents").Rows.Count &
"Records found!"
Call formatgrid()
Case "Browse"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents ", DataGridView1)
lblCount.Text = dtset.Tables("tblResidents").Rows.Count & " "
+ "Records found!"
Case "browse1"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents ", DataGridView1)
lblCount.Text = dtset.Tables("tblResidents").Rows.Count & " "
+ "Records found!"
Case "Browse3"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents ", DataGridView1)
lblCount.Text = dtset.Tables("tblResidents").Rows.Count & " "
+ "Records found!"
Case "DeadNotes"
Call LoadRecord(dt, dtset, "tbldeadnotes", "Select * from
tbldeadnotes", DataGridView1)
lblCount.Text = dtset.Tables("tbldeadnotes").Rows.Count & " "
+ "Records found!"
Call formatgrid()
Case "Migrated Person"
Call LoadRecord(dt, dtset, "tblMigrated", "Select * from
tblMigrated", DataGridView1)
lblCount.Text = dtset.Tables("tblMigrated").Rows.Count & " " +
"Records found!"
Call formatgrid()
End Select
End Sub

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


MyBase.Load
Call konneksyon()
End Sub
Sub formatgrid()
Select Case Trim(Me.Text)
Case "Migrated Person"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Full Name"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "Zone"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Sex"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Date of Birth"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Age"
DataGridView1.Columns(5).Width = 50
DataGridView1.Columns(6).HeaderText = "Status"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Date of Migrated"
DataGridView1.Columns(7).Width = 250
Case "DeadNotes"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Full Name"
DataGridView1.Columns(1).Width = 150
DataGridView1.Columns(2).HeaderText = "Date of Birth"
DataGridView1.Columns(2).Width = 150
DataGridView1.Columns(3).HeaderText = "Age"
DataGridView1.Columns(3).Width = 150
DataGridView1.Columns(4).HeaderText = "Date of death"
DataGridView1.Columns(4).Width = 170
DataGridView1.Columns(5).HeaderText = "Zone"
DataGridView1.Columns(5).Width = 150

Case "SeniorCitizen"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).HeaderText = "Resident ID"
DataGridView1.Columns(0).Width = 120
DataGridView1.Columns(1).HeaderText = "Last Name"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "First Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Last Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Zone"
DataGridView1.Columns(4).Width = 70
DataGridView1.Columns(5).HeaderText = "Sex"
DataGridView1.Columns(5).Width = 70
DataGridView1.Columns(6).HeaderText = "Date of Birth"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Age"
DataGridView1.Columns(7).Width = 50
DataGridView1.Columns(8).Visible = False
DataGridView1.Columns(9).Visible = False
DataGridView1.Columns(10).Visible = False
DataGridView1.Columns(11).Visible = False
DataGridView1.Columns(12).Visible = False
DataGridView1.Columns(13).Visible = False
Case "Residents"
DataGridView1.Font = dgFont
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Last Name"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "First Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Last Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Zone"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Sex"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Date of Birth"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Age"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Status"
DataGridView1.Columns(8).Width = 120
DataGridView1.Columns(9).HeaderText = "Religion"
DataGridView1.Columns(9).Width = 100
DataGridView1.Columns(10).HeaderText = "Nationality"
DataGridView1.Columns(10).Width = 120
DataGridView1.Columns(11).HeaderText = "Educational
Attaintment"
DataGridView1.Columns(11).Width = 270
DataGridView1.Columns(12).HeaderText = "Occupation"
DataGridView1.Columns(12).Width = 120
DataGridView1.Columns(13).HeaderText = "Employement"
DataGridView1.Columns(13).Width = 120
Case "Officials"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).Visible = False
DataGridView1.Columns(2).HeaderText = "Last Name"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "First Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Last Name"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Zone"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Sex"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Position"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Term"
DataGridView1.Columns(8).Width = 120
DataGridView1.Columns(9).HeaderText = "Date Start"
DataGridView1.Columns(9).Width = 120
DataGridView1.Columns(10).HeaderText = "Date End"
DataGridView1.Columns(10).Width = 120
Case "Projects"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Zone"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).HeaderText = "Project type"
DataGridView1.Columns(2).Width = 120
DataGridView1.Columns(3).HeaderText = "Funded By"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "Name of Donor"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Budget"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Date Started"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Date Finish"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Status"
Case "Security"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "Name"
DataGridView1.Columns(1).Width = 200
DataGridView1.Columns(2).HeaderText = "User Name"
DataGridView1.Columns(2).Width = 100
DataGridView1.Columns(3).Visible = False
DataGridView1.Columns(4).HeaderText = "Access Level"
DataGridView1.Columns(4).Width = 150
Case "HouseHold"
DataGridView1.Font = dgFont
DataGridView1.Columns(0).Visible = False
DataGridView1.Columns(1).HeaderText = "House ID"
DataGridView1.Columns(1).Width = 120
DataGridView1.Columns(2).Visible = False
DataGridView1.Columns(3).HeaderText = "Last Name"
DataGridView1.Columns(3).Width = 120
DataGridView1.Columns(4).HeaderText = "First Name"
DataGridView1.Columns(4).Width = 120
DataGridView1.Columns(5).HeaderText = "Last Name"
DataGridView1.Columns(5).Width = 120
DataGridView1.Columns(6).HeaderText = "Zone"
DataGridView1.Columns(6).Width = 120
DataGridView1.Columns(7).HeaderText = "Sex"
DataGridView1.Columns(7).Width = 120
DataGridView1.Columns(8).HeaderText = "Date of Birth"
DataGridView1.Columns(8).Width = 200
DataGridView1.Columns(9).HeaderText = "Age"
DataGridView1.Columns(9).Width = 120
DataGridView1.Columns(10).HeaderText = "Occupation"
DataGridView1.Columns(10).Width = 150
DataGridView1.Columns(11).HeaderText = "Electric"
DataGridView1.Columns(11).Width = 120
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

DataGridView1.Columns(12).HeaderText = "Water Seal"


DataGridView1.Columns(12).Width = 120
DataGridView1.Columns(13).HeaderText = "House Made Up"
DataGridView1.Columns(13).Width = 250
DataGridView1.Columns(14).HeaderText = "Auto Vehicle"
DataGridView1.Columns(14).Width = 200
DataGridView1.Columns(15).HeaderText = "Business"
DataGridView1.Columns(15).Width = 120
DataGridView1.Columns(16).HeaderText = "Pets"
DataGridView1.Columns(16).Width = 120
DataGridView1.Columns(17).HeaderText = "OFW in Family"
DataGridView1.Columns(17).Width = 220
DataGridView1.Columns(18).HeaderText = "Water style"
DataGridView1.Columns(18).Width = 220
DataGridView1.Columns(19).HeaderText = "Farm"
DataGridView1.Columns(19).Width = 120
End Select
End Sub
Sub AddRecord()
Select Case Trim(Me.Text)
Case "Security"
frmaeacounts.Text = "Add Security"
frmaeacounts.ShowDialog()
Case "Residents"
frmAEresidents.Text = "Add Residents"
frmAEresidents.ShowDialog()
Case "Officials"
SelectSwitch = 3
frmAEofficials.Text = "Add Officials"
frmAEofficials.ShowDialog()
Case "HouseHold"
frmAEHouseHold.Text = "Add HouseHold"
frmAEHouseHold.ShowDialog()
Case "Projects"
frmAEprojects.Text = "Add Project"
frmAEprojects.ShowDialog()

Case "DeadNotes"
frmAEdeadnotes.Text = "Add Dead Person"
frmAEdeadnotes.btnBrowse.Enabled = True
frmAEdeadnotes.ShowDialog()

Case "Migrated Person"


frmMigrate.Text = "Add Migrated Person"
frmMigrate.btnBrowse.Enabled = True
frmMigrate.ShowDialog()

End Select
End Sub
Private Sub DataGridView1_CellClick(sender As Object, e As
DataGridViewCellEventArgs) Handles DataGridView1.CellClick
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Select Case Trim(Me.Text)


Case "Residents"
If e.RowIndex <> -1 Then
frmAEresidents.txtID.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(0).ToString()
txtsss.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rLN").
ToString()
txtrresidentID.Text =
DataGridView1.CurrentRow.Cells(0).Value
txtrLN.Text = DataGridView1.CurrentRow.Cells(1).Value
txtrFN.Text = DataGridView1.CurrentRow.Cells(2).Value
txtrLM.Text = DataGridView1.CurrentRow.Cells(3).Value
txtrZone.Text = DataGridView1.CurrentRow.Cells(4).Value
txtRsex.Text = DataGridView1.CurrentRow.Cells(5).Value
txtrDOD.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(6).Value.ToString).ToString("M'/'d'/
'yyyy")
txtrAge.Text = DataGridView1.CurrentRow.Cells(7).Value
txtrStatus.Text = DataGridView1.CurrentRow.Cells(8).Value
txtrReligion.Text =
DataGridView1.CurrentRow.Cells(9).Value
txtrNationality.Text =
DataGridView1.CurrentRow.Cells(10).Value
txtreductional.Text =
DataGridView1.CurrentRow.Cells(11).Value
txtrOccupation.Text =
DataGridView1.CurrentRow.Cells(12).Value
txtemployment.Text =
DataGridView1.CurrentRow.Cells(13).Value

End If
Case "Browse"
If e.RowIndex <> -1 Then
frmAEofficials.txtresidentID.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(0).ToString()
frmAEofficials.txtlname.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(1).ToString()
frmAEofficials.txtfname.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(2).ToString()
frmAEofficials.txtmname.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(3).ToString()
frmAEofficials.txtGender.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(5).ToString()
frmAEofficials.txtzone.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(4).ToString()
frmAEdeadnotes.txtfullname.Text =
DataGridView1.CurrentRow.Cells(1).Value + "," +
DataGridView1.CurrentRow.Cells(2).Value + " " +
DataGridView1.CurrentRow.Cells(3).Value
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

frmAEdeadnotes.txtdateofbirth.Text =
DataGridView1.CurrentRow.Cells(6).Value
frmAEdeadnotes.txtage.Text =
DataGridView1.CurrentRow.Cells(7).Value
frmAEdeadnotes.txtzone.Text =
DataGridView1.CurrentRow.Cells(4).Value
frmAEdeadnotes.txtid.Text =
DataGridView1.CurrentRow.Cells(0).Value
Me.Close()
End If
Case "browse1"
If e.RowIndex <> -1 Then
frmAEHouseHold.txtResidentID.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(0).ToString()
frmAEHouseHold.txtlname.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(1).ToString()
frmAEHouseHold.txtfname.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(2).ToString()
frmAEHouseHold.txtage.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(3).ToString()
frmAEHouseHold.txtzone.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(4).ToString()
frmAEHouseHold.txtsex.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(5).ToString()
frmAEHouseHold.txtdob.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(6).ToString()
frmAEHouseHold.txtages.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(7).ToString()
frmAEHouseHold.txtocc.Text =
dtset.Tables("tblResidents").Rows(e.RowIndex).Item(12).ToString()
Me.Close()
End If
Case "Projects"
If e.RowIndex <> -1 Then

frmAEprojects.txtsel.Text =
dtset.Tables("tblProject").Rows(e.RowIndex).Item(0).ToString()
txtzoness.Text = DataGridView1.CurrentRow.Cells(1).Value
txtpro.Text = DataGridView1.CurrentRow.Cells(2).Value
txtfund.Text = DataGridView1.CurrentRow.Cells(3).Value
txtdonor.Text = DataGridView1.CurrentRow.Cells(4).Value
txtbud.Text = DataGridView1.CurrentRow.Cells(5).Value
txtdatest.Text = DataGridView1.CurrentRow.Cells(6).Value
txtdtend.Text = DataGridView1.CurrentRow.Cells(7).Value
txtidds.Text = DataGridView1.CurrentRow.Cells(0).Value
frmAEprojects.txtstat.Text =
DataGridView1.CurrentRow.Cells(8).Value
txtstatus.Text = DataGridView1.CurrentRow.Cells(8).Value

' txtoff.Text =
dtset.Tables("tblProject").Rows(e.RowIndex).Item(2).ToString()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End If
Case "Officials"
If e.RowIndex <> -1 Then
frmAEofficials.txtID.Text =
dtset.Tables("qryOfficials").Rows(e.RowIndex).Item(0).ToString()
txtoff.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("rLN").
ToString()
txtresidentID.Text =
DataGridView1.CurrentRow.Cells(1).Value
txtlastName.Text = DataGridView1.CurrentRow.Cells(2).Value
txtfname.Text = DataGridView1.CurrentRow.Cells(3).Value
txtmname.Text = DataGridView1.CurrentRow.Cells(4).Value
txtPosition.Text = DataGridView1.CurrentRow.Cells(7).Value
txtterm.Text = DataGridView1.CurrentRow.Cells(8).Value
txtFinish.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(9).Value.ToString).ToString("M'/'d'/
'yyyy")
txtdateEnd.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(10).Value.ToString).ToString("M'/'d'
/'yyyy")
End If
Case "HouseHold"
If e.RowIndex <> -1 Then
frmAEHouseHold.txtResidentID.Text =
dtset.Tables("qryHouseHold").Rows(e.RowIndex).Item(0).ToString()
txth.Text =
dtset.Tables("qryHouseHold").Rows(e.RowIndex).Item(0).ToString()
txtHousID.Text =
dtset.Tables("qryHouseHold").Rows(e.RowIndex).Item(1).ToString()
txtiDs.Text = DataGridView1.CurrentRow.Cells(0).Value
txtHhouseID.Text = DataGridView1.CurrentRow.Cells(1).Value
txtHResidentID.Text =
DataGridView1.CurrentRow.Cells(2).Value
txtHLN.Text = DataGridView1.CurrentRow.Cells(3).Value
txtHFN.Text = DataGridView1.CurrentRow.Cells(4).Value
txtMN.Text = DataGridView1.CurrentRow.Cells(5).Value

txtelectric.Text =
DataGridView1.CurrentRow.Cells(11).Value
txtwaterSealed.Text =
DataGridView1.CurrentRow.Cells(12).Value
txtmadeup.Text = DataGridView1.CurrentRow.Cells(13).Value
txtauto.Text = DataGridView1.CurrentRow.Cells(14).Value
txtbusiness.Text =
DataGridView1.CurrentRow.Cells(15).Value
txtpets.Text = DataGridView1.CurrentRow.Cells(16).Value
txtofw.Text = DataGridView1.CurrentRow.Cells(17).Value
txtwaterstyle.Text =
DataGridView1.CurrentRow.Cells(18).Value
txtfarms.Text = DataGridView1.CurrentRow.Cells(19).Value
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txthead.Text = DataGridView1.CurrentRow.Cells(20).Value
End If
Case "DeadNotes"
If e.RowIndex <> -1 Then
txts.Text = DataGridView1.CurrentRow.Cells(0).Value
End If
End Select
End Sub

Sub EditRecord()
Select Case Trim(Me.Text)
Case "Residents"
If frmAEresidents.txtID.Text = "" Then
MsgBox("Please Select a record", MsgBoxStyle.Information,
"System Message")
Else
frmAEresidents.Text = "Edit Residents"
frmAEresidents.cmreligion.Text =
DataGridView1.CurrentRow.Cells(9).Value
frmAEresidents.cmpwd.Text =
DataGridView1.CurrentRow.Cells(14).Value
frmAEresidents.txtLname.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rLN").
ToString()
frmAEresidents.txtFName.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rFN").
ToString()
frmAEresidents.txtMname.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rMN").
ToString()
frmAEresidents.cmbzone.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rZone"
).ToString()
frmAEresidents.cmbsex.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rSex")
.ToString()
frmAEresidents.cmbdate.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(6).Value.ToString).ToString("M'/'d'/
'yyyy")
frmAEresidents.txtage.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rAge")
.ToString()
frmAEresidents.cmbcivil.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rCstat
us").ToString()
frmAEresidents.cmreligion.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rRelig
ion").ToString()
frmAEresidents.txtnationality.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rNatio
nality").ToString()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

frmAEresidents.txteduca.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rEduca
tt").ToString()
frmAEresidents.txtoccu.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("roccup
tion").ToString()
frmAEresidents.txtemplo.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("rEmplo
yment").ToString()
frmAEresidents.cmb4ps.Text =
dtset.Tables("tblResidents").Rows(DataGridView1.CurrentRow.Index).Item("PPF").
ToString()
frmAEresidents.ShowDialog()
End If
Case "Officials"
If txtoff.Text = "" Then
MsgBox("Please Select a record", MsgBoxStyle.Information,
"System Message")
Else
frmAEofficials.Text = "Edit Officials"
frmAEofficials.txtresidentID.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("Reside
ntID").ToString()
frmAEofficials.txtlname.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("rLN").
ToString()
frmAEofficials.txtfname.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("rFN").
ToString()
frmAEofficials.txtmname.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("rMN").
ToString()
frmAEofficials.txtGender.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("rSex")
.ToString()
frmAEofficials.txtzone.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("rZone"
).ToString()
frmAEofficials.cmbPostion.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("Positi
on").ToString()
frmAEofficials.cmbTerm.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("Term")
.ToString()
frmAEofficials.cmbDateStart.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("DateSt
art").ToString()
frmAEofficials.cmdateEnd.Text =
dtset.Tables("qryOfficials").Rows(DataGridView1.CurrentRow.Index).Item("DateEn
d").ToString()
frmAEofficials.ShowDialog()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End If
Case "Projects"
If frmAEprojects.txtsel.Text = "" Then
MsgBox("Please Select a record", MsgBoxStyle.Information,
"System Message")
Else
frmAEprojects.Text = "Edit Projects"
frmAEprojects.cmbzone.Text =
dtset.Tables("tblProject").Rows(DataGridView1.CurrentRow.Index).Item("Zone").T
oString()
frmAEprojects.txtpro.Text =
dtset.Tables("tblProject").Rows(DataGridView1.CurrentRow.Index).Item("ProjectT
ype").ToString()
frmAEprojects.txtfun.Text =
dtset.Tables("tblProject").Rows(DataGridView1.CurrentRow.Index).Item("FundedBy
").ToString()
frmAEprojects.txtdonor.Text =
dtset.Tables("tblProject").Rows(DataGridView1.CurrentRow.Index).Item("NameOfDo
nor").ToString()
frmAEprojects.txtbud.Text =
dtset.Tables("tblProject").Rows(DataGridView1.CurrentRow.Index).Item("Budget")
.ToString()
frmAEprojects.txtstat.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(6).Value.ToString).ToString("M'/'d'/
'yyyy")
frmAEprojects.txtdatef.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(7).Value.ToString).ToString("M'/'d'/
'yyyy")
frmAEprojects.txtstat.Text =
DataGridView1.CurrentRow.Cells(8).Value
frmAEprojects.Show()
End If
Case "HouseHold"
If txth.Text = "" Then
MsgBox("Please Select a record", MsgBoxStyle.Information,
"System Message")
Else
frmAEHouseHold.Text = "Edit houseHold"
frmAEHouseHold.txtlname.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rLN").
ToString()
frmAEHouseHold.txtfname.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rFN").
ToString()
frmAEHouseHold.txtages.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rMN").
ToString()
frmAEHouseHold.txtzone.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rZone"
).ToString()
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

frmAEHouseHold.txtsex.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rSex")
.ToString()
frmAEHouseHold.txtdob.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rDOB")
.ToString()
frmAEHouseHold.txtage.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("rAge")
.ToString()
frmAEHouseHold.txtocc.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("roccup
tion").ToString()
frmAEHouseHold.txtHouseID.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("houseI
D").ToString()
frmAEHouseHold.txtResidentID.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Reside
ntID").ToString()
frmAEHouseHold.cmbElectric.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Electr
ic").ToString()
frmAEHouseHold.cmbwaterseal.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("waterS
ealled").ToString()
frmAEHouseHold.cmbhmadeup.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("MadeHo
use").ToString()
frmAEHouseHold.cmAutoVehicle.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("AutoVe
hicle").ToString()
frmAEHouseHold.txtbusiness.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Busine
ss").ToString()
frmAEHouseHold.cmbpet.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Pets")
.ToString()
frmAEHouseHold.cmbOFW.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Family
OFW").ToString()
frmAEHouseHold.cmbwater.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("WaterS
tyle").ToString()
frmAEHouseHold.cmbFarm.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Farms"
).ToString()
frmAEHouseHold.txthead.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Head")
.ToString()
frmAEHouseHold.ShowDialog()
End If
Case "Browse"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

frmAEHouseHold.txtHouseID.Text =
dtset.Tables("qryHouseHold").Rows(DataGridView1.CurrentRow.Index).Item("Reside
ntID").ToString()
Case "DeadNotes"
frmAEdeadnotes.Text = "Edit Dead Person"
frmAEdeadnotes.btnBrowse.Enabled = False
frmAEdeadnotes.txtfullname.Text =
DataGridView1.CurrentRow.Cells(1).Value
frmAEdeadnotes.txtdateofbirth.Text =
DataGridView1.CurrentRow.Cells(2).Value
frmAEdeadnotes.txtage.Text =
DataGridView1.CurrentRow.Cells(3).Value
frmAEdeadnotes.DateTimePicker1.Text =
DataGridView1.CurrentRow.Cells(4).Value
frmAEdeadnotes.txtzone.Text =
DataGridView1.CurrentRow.Cells(5).Value
frmAEdeadnotes.txtsel.Text =
DataGridView1.CurrentRow.Cells(0).Value
frmAEdeadnotes.ShowDialog()
Case "Security"
frmAEsecurity.txtfullname.Text =
DataGridView1.CurrentRow.Cells(1).Value
frmAEsecurity.txtUname.Text =
DataGridView1.CurrentRow.Cells(2).Value
frmAEsecurity.txtPword.Text =
DataGridView1.CurrentRow.Cells(3).Value
frmAEsecurity.cmbACClevel.Text =
DataGridView1.CurrentRow.Cells(4).Value
frmAEsecurity.txtID.Text =
DataGridView1.CurrentRow.Cells(0).Value
frmAEsecurity.ShowDialog()
Case "Migrated Person"
frmMigrate.Text = "Edit Migrated Person"
frmMigrate.btnBrowse.Enabled = False
frmMigrate.txtIDs.Text =
DataGridView1.CurrentRow.Cells(0).Value
frmMigrate.txtfuname.Text =
DataGridView1.CurrentRow.Cells(1).Value
frmMigrate.cmbzone.Text =
DataGridView1.CurrentRow.Cells(2).Value
frmMigrate.cmbsex.Text =
DataGridView1.CurrentRow.Cells(3).Value
frmMigrate.cmbdate.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(4).Value.ToString).ToString("M'/'d'/
'yyyy")
frmMigrate.txtage.Text =
DataGridView1.CurrentRow.Cells(5).Value
frmMigrate.cmbcivil.Text =
DataGridView1.CurrentRow.Cells(6).Value
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

frmMigrate.DateTimePicker1.Text =
Date.Parse(DataGridView1.CurrentRow.Cells(7).Value.ToString).ToString("M'/'d'/
'yyyy")
frmMigrate.ShowDialog()
End Select
End Sub
Sub delete()
Select Case Trim(Me.Text)
Case "Migrated Person"
If txtauto.Text = "" Then
MsgBox("Unenable to Transfer ", MsgBoxStyle.Information,
"System Message")
End If
Case "DeadNotes"
If txtauto.Text = "" Then
MsgBox("Unenable to Transfer ", MsgBoxStyle.Information,
"System Message")

End If
Case "HouseHold"
If txtiDs.Text = "" Then
MsgBox("Please select a Record", MsgBoxStyle.Information,
"System Message")
Else
If MsgBox("Do you want to move this record from
archives?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "System Message") =
MsgBoxResult.Yes Then
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblHouseHoldArchive
(HouseID,ResidentID,Lname,lfname,lmname,Electric,WaterSealled,MadeHouse,AutoVe
hicle,Business,Pets,FamilyOFW,WaterStyle,Farms,Head) values (" &
txtHousID.Text & "," & txtHResidentID.Text & ",'" & txtHLN.Text & "','" &
txtHFN.Text & "','" & txtMN.Text & "','" & txtelectric.Text & "','" &
txtwaterSealed.Text & "','" & txtmadeup.Text & "','" & txtauto.Text & "','" &
txtbusiness.Text & "','" & txtpets.Text & "','" & txtofw.Text & "','" &
txtwaterstyle.Text & "','" & txtfarms.Text & "','" & txthead.Text & "')"
kom.ExecuteNonQuery()
kom.CommandText = "delete * from tblHouseHold Where
ID=" & txtiDs.Text
kom.ExecuteNonQuery()
Call pupulate()
End If
End If
Case "Residents"
Dim a As String
a = "Deleted"
If txtsss.Text = "" Then
MsgBox("Please Select a Record", MsgBoxStyle.Information,
"System Message")
Else
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

If MsgBox("Do you want to move this record from


archives?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "System Message") =
MsgBoxResult.Yes Then
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblResidentArchive
([ResidentID],[rLN],[rFN],[rMN],[rZone],[rSex],[rDOB],[rAge],[rCstatus],
[rReligion],[rNationality],[rEducatt],[roccuption],[rEmployment],[Status])
values (" & txtrresidentID.Text & ",'" & txtrLN.Text & "','" & txtrFN.Text &
"','" & txtrLM.Text & "','" & txtrZone.Text & "','" & txtRsex.Text & "','" &
txtrDOD.Text & "'," & txtrAge.Text & ",'" & txtrStatus.Text & "','" &
txtrReligion.Text & "','" & txtrNationality.Text & "','" & txtreductional.Text
& "','" & txtrOccupation.Text & "','" & txtemployment.Text & "','" & a & "')"
kom.ExecuteNonQuery()
kom.CommandText = "delete * from tblResidents Where
ResidentID=" & frmAEresidents.txtID.Text
kom.ExecuteNonQuery()
Call pupulate()
End If
End If
Case "Officials"
Dim acc As String
acc = "Previuos"
If txtoff.Text = "" Then
MsgBox("Please select a Record", MsgBoxStyle.Information,
"System Message")
Else
If MsgBox("Do you want to move this record from
archives?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "System Message") =
MsgBoxResult.Yes Then
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into tblOfficialsArchive
([ResidentID],[lname],[fname],[mname],[Postion],[Term],[DateStart],
[DateFinish],[Status]) values (" & txtresidentID.Text & ",'" &
txtlastName.Text & "','" & txtfname.Text & "','" & txtmname.Text & "','" &
txtPosition.Text & "','" & txtterm.Text & "','" & txtFinish.Text & "','" &
txtdateEnd.Text & "','" & acc & "')"
kom.ExecuteNonQuery()
kom.CommandText = "delete * from tblOfficials Where
OfficialsID=" & frmAEofficials.txtID.Text
kom.ExecuteNonQuery()
Call pupulate()
End If
End If
Case "Projects"
If txtzoness.Text = "" Then
MsgBox("Please Select a Record", MsgBoxStyle.Information,
"System Message")
Else
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

If MsgBox("Do you want to move this record from


archives?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "System Message") =
MsgBoxResult.Yes Then
Dim ass As String
ass = "Finish"
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = "insert into
tblProjectArchive([Zone],[ProjectType],[FundedBy],[NameOfDonor],[Budget],
[DateStarted],[DateFinish],[Status]) values ('" & txtzoness.Text & "','" &
txtpro.Text & "','" & txtfund.Text & "','" & txtdonor.Text & "'," &
txtbud.Text & ",'" & txtdatest.Text & "','" & txtdtend.Text & "','" & ass &
"')"
kom.ExecuteNonQuery()
kom.CommandText = "delete * from tblProject Where ID="
& txtidds.Text
kom.ExecuteNonQuery()
Call pupulate()
End If
End If
End Select
End Sub
Private Sub txtsearch_TextChanged(sender As Object, e As EventArgs)
Handles txtsearch.TextChanged
Select Case Trim(Me.Text)
Case "Migrated Person"
Call LoadRecord(dt, dtset, "tblMigrated", "Select * from
tblMigrated where fullName like '%" & txtsearch.Text & "%'", DataGridView1)
Case "DeadNotes"
Call LoadRecord(dt, dtset, "tbldeadnotes", "Select * from
tbldeadnotes where FullName like '%" & txtsearch.Text & "%'", DataGridView1)
Case "Projects"
Call LoadRecord(dt, dtset, "tblproject", "Select * from
tblproject where ProjectType like '%" & txtsearch.Text & "%'", DataGridView1)
Case "Residents"
Call LoadRecord(dt, dtset, "tblResidents", "Select * FROM
tblResidents WHERE ResidentID Like '%" & txtsearch.Text & "%' or rLN like '%"
& txtsearch.Text & "%' or rFN like '%" & txtsearch.Text & "%'or rMN like '%" &
txtsearch.Text & "%'or rZone Like '%" & txtsearch.Text & "%'or rSex Like '%" &
txtsearch.Text & "%'", DataGridView1)
Case "Officials"
Call LoadRecord(dt, dtset, "qryOfficials", "Select * FROM
qryOfficials WHERE ResidentID Like '%" & txtsearch.Text & "%' or rLN Like '%"
& txtsearch.Text & "%'or rFN Like '%" & txtsearch.Text & "%'or rMN Like '%" &
txtsearch.Text & "%'or rZone Like '%" & txtsearch.Text & "%'or rSex Like '%" &
txtsearch.Text & "%'", DataGridView1)
Case "HouseHold"
Call LoadRecord(dt, dtset, "qryHouseHold", "Select * from
qryHouseHold Where HouseID like '%" & txtsearch.Text & "%' or rLN Like '%" &
txtsearch.Text & "%'or rFN Like '%" & txtsearch.Text & "%'or rMN Like '%" &
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

txtsearch.Text & "%'or rZone Like '%" & txtsearch.Text & "%'or rSex Like '%" &
txtsearch.Text & "%'", DataGridView1)
End Select
End Sub
Private Sub frmRecord_Activated(sender As Object, e As EventArgs) Handles
Me.Activated
Call pupulate()
End Sub
Sub print()
Select Case Trim(Me.Text)
Case "Residents"
reports = 1
Case "Officials"
reports = 2
Case "Projects"
reports = 3
Case "DeadNotes"
reports = 4
Case "Migrated Person"
reports = 5
End Select
frmRecordPrint.ShowDialog()
End Sub

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


picEdit.Click
EditRecord()
End Sub

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


picClose.Click
Close()
End Sub

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


picArchive.Click
If frmMain.lblaccess.Text = "User" Then
MsgBox("Sorry Only Administrator can delete the record",
MsgBoxStyle.Critical, "System Message")
Else
delete()
End If
End Sub
Private Sub picPrint_Click(sender As Object, e As EventArgs) Handles
picPrint.Click
print()
End Sub
Sub cleardeadnotes()
frmAEdeadnotes.txtfullname.Text = ""
frmAEdeadnotes.txtdateofbirth.Text = ""
frmAEdeadnotes.txtage.Text = ""
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

frmAEdeadnotes.txtzone.Text = ""
frmAEdeadnotes.txtid.Text = ""
End Sub
Private Sub picadd1_Click(sender As Object, e As EventArgs) Handles
picadd1.Click
cleardeadnotes()
frmAEprojects.clear()
frmAEofficials.clear()
frmAEHouseHold.clear()
frmAEresidents.clear()
AddRecord()
End Sub

Private Sub DataGridView1_CellContentClick(sender As Object, e As


DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

End Sub
End Class
“for print the data
Imports System.Data.OleDb
Public Class frmRecordPrint
Dim dt, dreport As New OleDbDataAdapter
Dim dset, dsreport As New DataSet

Private Sub CrystalReportViewer1_Load(sender As Object, e As EventArgs)


Handles CrystalReportViewer1.Load

End Sub

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


MyBase.Load
Select Case reports
Case 1
Call konneksyon()
Dim resident As New crResident
dt = New OleDbDataAdapter("Select * from tblResidents ORDER By
rLN ", kon)
dset = New DataSet
dt.Fill(dset)
resident.SetDatabaseLogon("Admin", "helloworld")
resident.SetDataSource(dset.Tables("tblResidents"))
CrystalReportViewer1.ReportSource = resident
CrystalReportViewer1.RefreshReport()
Case 2
Call konneksyon()
Dim Official As New crofficial
dt = New OleDbDataAdapter("Select * from tblOfficials ", kon)
dset = New DataSet
dt.Fill(dset)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Official.SetDataSource(dset.Tables("tblOfficials"))
CrystalReportViewer1.ReportSource = Official
CrystalReportViewer1.RefreshReport()
Case 3
Call konneksyon()
Dim project As New crproject
dt = New OleDbDataAdapter("Select * from tblProject ", kon)
dset = New DataSet
dt.Fill(dset)
project.SetDataSource(dset.Tables("tblProject"))
CrystalReportViewer1.ReportSource = project
CrystalReportViewer1.RefreshReport()
Case 4
Call konneksyon()
Dim deadnotes As New crDeadNotes
dt = New OleDbDataAdapter("Select * from tbldeadnotes ", kon)
dset = New DataSet
dt.Fill(dset)
deadnotes.SetDataSource(dset.Tables("tbldeadnotes"))
CrystalReportViewer1.ReportSource = deadnotes
CrystalReportViewer1.RefreshReport()
Case 5
Call konneksyon()
Dim migrated As New crMigrated
dt = New OleDbDataAdapter("Select * from tblMigrated ", kon)
dset = New DataSet
dt.Fill(dset)
migrated.SetDataSource(dset.Tables("tblMigrated "))
CrystalReportViewer1.ReportSource = migrated
CrystalReportViewer1.RefreshReport()
End Select
End Sub
End Class

“under security
Public Class frmReset
Dim x, m, s As Integer

Private Sub frmResetPassword_Load(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles MyBase.Load
txtNPword.Clear()
txtCPword.Clear()
End Sub

Private Sub txtNPword_TextChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles txtNPword.TextChanged
If txtNPword.Text.Length > 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Dim numDigits As Integer = 0


Dim numAlpha As Integer = 0
Dim x As Integer
Dim s As String = Trim(txtNPword.Text)
For x = 0 To s.Length - 1
If Char.IsNumber(s(x)) Then
numDigits = numDigits + 1
End If
If Char.IsLetter(s(x)) Then
numAlpha = numAlpha + 1
End If
Next
If numDigits > 4 And numAlpha > 4 Then
lblPwordStrength.Text = "Strong"
lblPwordStrength.ForeColor = Color.Green
ElseIf numDigits > 2 And numAlpha > 2 Then
lblPwordStrength.Text = "Moderate"
lblPwordStrength.ForeColor = Color.Orange
ElseIf numDigits > 2 And numAlpha = 0 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
ElseIf numDigits = 0 And numAlpha > 2 Then
lblPwordStrength.Text = "Weak"
lblPwordStrength.ForeColor = Color.Red
End If
Else
lblPwordStrength.Text = ""
End If
End Sub

Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnReset.Click
If Trim(txtNPword.Text) = "" Or Trim(txtCPword.Text) = "" Then
MsgBox("Unable to reset password. Required fields missing!",
MsgBoxStyle.Information, "Reset Failed")
Exit Sub
End If
If Trim(txtNPword.Text) <> Trim(txtCPword.Text) Then
MsgBox("Unable to reset password. Passwords did not match",
MsgBoxStyle.Information, "Reset Failed")
Exit Sub
End If
If Trim(txtNPword.Text).Length < 8 Then
MsgBox("Password too short. Password must be 8-16 characters",
MsgBoxStyle.Information, "Password too short")
Exit Sub
End If
executeSQLStatement("Update tblSecurity set Pword='" &
Trim(txtNPword.Text) & "' where UName='" &
Trim(frmForgotPassword.lblUName.Text) & "'")
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

MsgBox("Password reset successful!", MsgBoxStyle.Information, "Reset


Successful")
Me.Close()
frmForgotPassword.Close()
frmEnterUserName.Close()
End Sub

Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnBack.Click
Me.Close()
End Sub

Private Sub txtNPword_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtNPword.KeyPress
If Asc(e.KeyChar) = 13 Then
txtCPword.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtCPword_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtCPword.KeyPress
If Asc(e.KeyChar) = 13 Then
btnReset.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Label3.Click

End Sub

Private Sub pnlResetPassword_Paint(ByVal sender As System.Object, ByVal e


As System.Windows.Forms.PaintEventArgs) Handles pnlResetPassword.Paint

End Sub
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End Class

“ for statistic of barangay


Imports System.Data.OleDb
Public Class frmstat
Dim dt As New OleDbDataAdapter
Dim dtset As DataSet
Dim kom As New OleDbCommand
Dim color As New Color
Private Sub frmstat_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
Call konneksyon()
End Sub
Private Sub btnperzone_Click(sender As Object, e As EventArgs) Handles
btnperzone.Click
If Label4.Text = "start" Then
chartt()
Label4.Text = "stop"
Else
MsgBox("The Chart run one at a time only",
MsgBoxStyle.Information, "System Message")
End If
End Sub
Sub chartt()
Dim a, b, c, d, ee, f, g As New Integer
Chart1.Visible = True
lblmess.Visible = True
Call LoadRecord(dt, dtset, "tblResidents", "Select * from tblResidents
where rZone='Zone 1'", DataGridView1)
a = dtset.Tables("tblResidents").Rows.Count
Me.Chart1.Series("Series1").Points.AddXY("Zone 1", a)
Call LoadRecord(dt, dtset, "tblResidents", "Select * from tblResidents
where rZone='Zone 2'", DataGridView1)
b = dtset.Tables("tblResidents").Rows.Count
Me.Chart1.Series("Series1").Points.AddXY("Zone 2", b)
Call LoadRecord(dt, dtset, "tblResidents", "Select * from tblResidents
where rZone='Zone 3'", DataGridView1)
c = dtset.Tables("tblResidents").Rows.Count
Me.Chart1.Series("Series1").Points.AddXY("Zone 3", c)
Call LoadRecord(dt, dtset, "tblResidents", "Select * from tblResidents
where rZone='Zone 4'", DataGridView1)
d = dtset.Tables("tblResidents").Rows.Count
Me.Chart1.Series("Series1").Points.AddXY("Zone 4", d)
Call LoadRecord(dt, dtset, "tblResidents", "Select * from tblResidents
where rZone='Zone 5'", DataGridView1)
ee = dtset.Tables("tblResidents").Rows.Count
Me.Chart1.Series("Series1").Points.AddXY("Zone 5", ee)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Call LoadRecord(dt, dtset, "tblResidents", "Select * from tblResidents


where rZone='Zone 6'", DataGridView1)
f = dtset.Tables("tblResidents").Rows.Count
Me.Chart1.Series("Series1").Points.AddXY("Zone 6", f)
Call LoadRecord(dt, dtset, "tblResidents", "Select * from tblResidents
where rZone='Zone 7'", DataGridView1)
g = dtset.Tables("tblResidents").Rows.Count
Me.Chart1.Series("Series1").Points.AddXY("Zone 7", g)
Chart1.Visible = True
lblmess.Text = "Note:The Char run one at a time only"
lblinfo.Text = "Per Zone Population Chart"
dgvzones.Visible = False
dgvage.Visible = False
dgvzones.Visible = False
dgveduc.Visible = False
dgvcivil.Visible = False
End Sub
Sub DpAge()
'compute distribution of population according to Age and Sex
Dim Mctr(19), Fctr(19), Bctr(19), x, a, b, c, xAge As Integer
Dim Mp(19), Fp(19) As Double
Dim AG(19), xSex As String

AG(0) = "Under 1 yr. old"


AG(1) = "1-4"
AG(2) = "5-9"
AG(3) = "10-14"
AG(4) = "15-19"
AG(5) = "20-24"
AG(6) = "25-29"
AG(7) = "30-34"
AG(8) = "35-39"
AG(9) = "40-44"
AG(10) = "45-49"
AG(11) = "50-54"
AG(12) = "55-59"
AG(13) = "60-64"
AG(14) = "65-69"
AG(15) = "70-74"
AG(16) = "75-79"
AG(17) = "80 and over"
AG(18) = "All Ages"

Call LoadRecord(dt, dtset, "tblResidents", "Select * from


tblResidents", dgv3)
x = dtset.Tables(0).Rows.Count
For a = 0 To dtset.Tables(0).Rows.Count - 1
xSex = dtset.Tables(0).Rows(a).Item(5).ToString
xAge = dtset.Tables(0).Rows(a).Item(7).ToString
'Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents ", dgvrecord)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Select Case xSex


Case "Male"
'for male
If xAge = 0 Then
Mctr(1) += 1
ElseIf xAge <= 4 Then
Mctr(2) += 1
ElseIf xAge <= 9 Then
Mctr(3) += 1
ElseIf xAge <= 14 Then
Mctr(4) += 1
ElseIf xAge <= 19 Then
Mctr(5) += 1
ElseIf xAge <= 24 Then
Mctr(6) += 1
ElseIf xAge <= 29 Then
Mctr(7) += 1
ElseIf xAge <= 34 Then
Mctr(8) += 1
ElseIf xAge <= 39 Then
Mctr(9) += 1
ElseIf xAge <= 44 Then
Mctr(10) += 1
ElseIf xAge <= 49 Then
Mctr(11) += 1
ElseIf xAge <= 54 Then
Mctr(12) += 1
ElseIf xAge <= 59 Then
Mctr(13) += 1
ElseIf xAge <= 64 Then
Mctr(14) += 1
ElseIf xAge <= 69 Then
Mctr(15) += 1
ElseIf xAge <= 74 Then
Mctr(16) += 1
ElseIf xAge <= 79 Then
Mctr(17) += 1
ElseIf xAge <= 80 Then
Mctr(18) += 1
End If

Mctr(19) += 1
Case "Female"
'for female
If xAge = 0 Then
Fctr(1) += 1
ElseIf xAge <= 4 Then
Fctr(2) += 1
ElseIf xAge <= 9 Then
Fctr(3) += 1
ElseIf xAge <= 14 Then
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Fctr(4) += 1
ElseIf xAge <= 19 Then
Fctr(5) += 1
ElseIf xAge <= 24 Then
Fctr(6) += 1
ElseIf xAge <= 29 Then
Fctr(7) += 1
ElseIf xAge <= 34 Then
Fctr(8) += 1
ElseIf xAge <= 39 Then
Fctr(9) += 1
ElseIf xAge <= 44 Then
Fctr(10) += 1
ElseIf xAge <= 49 Then
Fctr(11) += 1
ElseIf xAge <= 54 Then
Fctr(12) += 1
ElseIf xAge <= 59 Then
Fctr(13) += 1
ElseIf xAge <= 64 Then
Fctr(14) += 1
ElseIf xAge <= 69 Then
Fctr(15) += 1
ElseIf xAge <= 74 Then
Fctr(16) += 1
ElseIf xAge <= 79 Then
Fctr(17) += 1
ElseIf xAge <= 80 Then
Fctr(18) += 1
End If
Fctr(19) += 1
End Select
'for both sexes
If xAge = 0 Then
Bctr(1) += 1
ElseIf xAge <= 4 Then
Bctr(2) += 1
ElseIf xAge <= 9 Then
Bctr(3) += 1
ElseIf xAge <= 14 Then
Bctr(4) += 1
ElseIf xAge <= 19 Then
Bctr(5) += 1
ElseIf xAge <= 24 Then
Bctr(6) += 1
ElseIf xAge <= 29 Then
Bctr(7) += 1
ElseIf xAge <= 34 Then
Bctr(8) += 1
ElseIf xAge <= 39 Then
Bctr(9) += 1
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

ElseIf xAge <= 44 Then


Bctr(10) += 1
ElseIf xAge <= 49 Then
Bctr(11) += 1
ElseIf xAge <= 54 Then
Bctr(12) += 1
ElseIf xAge <= 59 Then
Bctr(13) += 1
ElseIf xAge <= 64 Then
Bctr(14) += 1
ElseIf xAge <= 69 Then
Bctr(15) += 1
ElseIf xAge <= 74 Then
Bctr(16) += 1
ElseIf xAge <= 79 Then
Bctr(17) += 1
ElseIf xAge <= 80 Then
Bctr(18) += 1
End If
Bctr(19) += 1
Next a

For b = 1 To 19
If x = 0 Then
Mp(b) = 0
Fp(b) = 0
Else
Mp(b) = Mctr(b) / x * 100
Fp(b) = Fctr(b) / x * 100
End If
Next b

For c = 1 To 19
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = ("update tblDPage set a_BothSexes=" & Bctr(c) &
",a_Male=" & Mctr(c) & ",a_Mpercent=" & Mp(c) & ",a_Female=" & Fctr(c) &
",a_Fpercent=" & Fp(c) & " where ID=" & c & "")
kom.ExecuteNonQuery()
Next
Call LoadRecord(da, dtset, "tblDPage", "Select * from tblDPage",
dgvage)
dgvage.DataSource = dtset.Tables(0)
dgvage.ColumnHeadersDefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
dgvage.DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
dgvage.Columns(0).Visible = False
dgvage.Rows(19).Height = 40
dgvage.Columns(1).HeaderText = "Age Group"
dgvage.Columns(1).Width = 120
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

dgvage.Columns(2).HeaderText = "Both Sexes"


dgvage.Columns(2).Width = 120
dgvage.Columns(3).HeaderText = "Male"
dgvage.Columns(3).Width = 95
dgvage.Columns(4).HeaderText = "(%)"
dgvage.Columns(4).Width = 95
dgvage.Columns(4).DefaultCellStyle.Format = "##.##"
dgvage.Columns(5).HeaderText = "Female"
dgvage.Columns(5).Width = 95
dgvage.Columns(6).HeaderText = "(%)"
dgvage.Columns(6).Width = 95
dgvage.Columns(6).DefaultCellStyle.Format = "##.##"
End Sub
Sub DpEduc()
'compute distribution of population according to Zone and Sex
Dim Mctr(9), Fctr(9), Bctr(9), x, a, b, c As Integer
Dim Mp(9), Fp(9) As Double
Dim EA(9), xSex, xEA As String

EA(0) = "NONE"
EA(1) = "PRE-SCHOOL"
EA(2) = "ELEMENTARY LEVEL"
EA(3) = "ELEMENTARY GRADUATE"
EA(4) = "HIGH SCHOOL LEVEL"
EA(5) = "HIGH SCHOOL GRADUATE"
EA(6) = "VOCATIONAL"
EA(7) = "COLLEGE LEVEL"
EA(8) = "COLLEGE GRADUATE"
EA(9) = "POST BACCALAUREATE"

'executeSQLStatement("select * from tblResidents")


'x = MyDataSet.Tables(0).Rows.Count
'For a = 0 To MyDataSet.Tables(0).Rows.Count - 1
' xSex = MyDataSet.Tables(0).Rows(a).Item("r_Sex").ToString
'xEA = MyDataSet.Tables(0).Rows(a).Item("r_EducAttainment").ToString
Call LoadRecord(dt, dtset, "tblResidents", "Select * from
tblResidents", dgv3)
x = dtset.Tables(0).Rows.Count
For a = 0 To dtset.Tables(0).Rows.Count - 1
xSex = dtset.Tables(0).Rows(a).Item(5).ToString
xEA = dtset.Tables(0).Rows(a).Item(11).ToString

Select Case xSex


Case "Male"
'for Male
Select Case xEA
Case "NONE"
Mctr(0) += 1
Case "PRE-SCHOOL"
Mctr(1) += 1
Case "ELEMENTARY LEVEL"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Mctr(2) += 1
Case "ELEMENTARY GRADUATE"
Mctr(3) += 1
Case "HIGH SCHOOL LEVEL"
Mctr(4) += 1
Case "HIGH SCHOOL GRADUATE"
Mctr(5) += 1
Case "VOCATIONAL"
Mctr(6) += 1
Case "COLLEGE LEVEL"
Mctr(7) += 1
Case "COLLEGE GRADUATE"
Mctr(8) += 1
Case "POST BACCALAUREATE"
Mctr(9) += 1
End Select
Case "Female"
'for female
Select Case xEA
Case "NONE"
Fctr(0) += 1
Case "PRE-SCHOOL"
Fctr(1) += 1
Case "ELEMENTARY LEVEL"
Fctr(2) += 1
Case "ELEMENTARY GRADUATE"
Fctr(3) += 1
Case "HIGH SCHOOL LEVEL"
Fctr(4) += 1
Case "HIGH SCHOOL GRADUATE"
Fctr(5) += 1
Case "VOCATIONAL"
Fctr(6) += 1
Case "COLLEGE LEVEL"
Fctr(7) += 1
Case "COLLEGE GRADUATE"
Fctr(8) += 1
Case "POST BACCALAUREATE"
Fctr(9) += 1
End Select
End Select

'for both sexes


Select Case xEA
Case "NONE"
Bctr(0) += 1
Case "PRE-SCHOOL"
Bctr(1) += 1
Case "ELEMENTARY LEVEL"
Bctr(2) += 1
Case "ELEMENTARY GRADUATE"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Bctr(3) += 1
Case "HIGH SCHOOL LEVEL"
Bctr(4) += 1
Case "HIGH SCHOOL GRADUATE"
Bctr(5) += 1
Case "VOCATIONAL"
Bctr(6) += 1
Case "COLLEGE LEVEL"
Bctr(7) += 1
Case "COLLEGE GRADUATE"
Bctr(8) += 1
Case "POST BACCALAUREATE"
Bctr(9) += 1
End Select
Next a

For b = 0 To 9
If x = 0 Then
Mp(b) = 0
Fp(b) = 0
Else
Mp(b) = Mctr(b) / x * 100
Fp(b) = Fctr(b) / x * 100
End If
Next b
For c = 0 To 9
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = ("update tblDPeduc set a_BothSexes=" & Bctr(c) &
",a_Male=" & Mctr(c) & ",a_Mpercent=" & Mp(c) & ",a_Female=" & Fctr(c) &
",a_Fpercent=" & Fp(c) & " where a_Educ='" & EA(c) & "'")
kom.ExecuteNonQuery()
Next

Call LoadRecord(dt, dtset, "tblDPeduc", "select * from tblDPeduc",


dgveduc)
dgveduc.DataSource = dtset.Tables(0)
dgveduc.ColumnHeadersDefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
dgveduc.DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
dgveduc.Rows(0).Height = 40
dgveduc.Columns(0).HeaderText = "EducationAl Attainment"
dgveduc.Columns(0).Width = 200
dgveduc.Columns(1).HeaderText = "Both Sexes"
dgveduc.Columns(1).Width = 95
dgveduc.Columns(2).HeaderText = "Male"
dgveduc.Columns(2).Width = 95
dgveduc.Columns(3).HeaderText = "(%)"
dgveduc.Columns(3).Width = 95
dgveduc.Columns(3).DefaultCellStyle.Format = "##.##"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

dgveduc.Columns(4).HeaderText = "Female"
dgveduc.Columns(4).Width = 95
dgveduc.Columns(5).HeaderText = "(%)"
dgveduc.Columns(5).Width = 95
dgveduc.Columns(5).DefaultCellStyle.Format = "##.##"
End Sub
Private Sub btnagsex_Click(sender As Object, e As EventArgs) Handles
btnagsex.Click
lblmess.Visible = False
lblinfo.Text = "Distribution of Population According to Age and Sex"
Chart1.Visible = False
dgvage.Visible = True
dgvzones.Visible = False
dgveduc.Visible = False
dgvcivil.Visible = False
DpAge()
End Sub
Sub DPzone()
'compute distribution of population according to Zone and Sex
Dim Mctr(6), Fctr(6), Bctr(6), x, a, b, c As Integer
Dim Mp(6), Fp(6) As Double
Dim Zone(6), xSex, xZone As String

Zone(0) = "Zone 1"


Zone(1) = "Zone 2"
Zone(2) = "Zone 3"
Zone(3) = "Zone 4"
Zone(4) = "Zone 5"
Zone(5) = "Zone 6"
Zone(6) = "Zone 7"

Call LoadRecord(dt, dtset, "tblResidents", "Select * from tblResidents


", dgvrecord)
x = dtset.Tables(0).Rows.Count
For a = 0 To dtset.Tables(0).Rows.Count - 1
xSex = dtset.Tables(0).Rows(a).Item(5).ToString
xZone = dtset.Tables(0).Rows(a).Item(4).ToString

Select Case xSex


Case "Male"
'For Male
Select Case xZone
Case "Zone 1"
Mctr(0) += 1
Case "Zone 2"
Mctr(1) += 1
Case "Zone 3"
Mctr(2) += 1
Case "Zone 4"
Mctr(3) += 1
Case "Zone 5"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Mctr(4) += 1
Case "Zone 6"
Mctr(5) += 1
Case "Zone 7"
Mctr(6) += 1
End Select
Case "Female"
Select Case xZone
'for Female
Case "Zone 1"
Fctr(0) += 1
Case "Zone 2"
Fctr(1) += 1
Case "Zone 3"
Fctr(2) += 1
Case "Zone 4"
Fctr(3) += 1
Case "Zone 5"
Fctr(4) += 1
Case "Zone 6"
Fctr(5) += 1
Case "Zone 7"
Fctr(6) += 1
End Select
End Select
'for Both Sexes
Select Case xZone
Case "Zone 1"
Bctr(0) += 1
Case "Zone 2"
Bctr(1) += 1
Case "Zone 3"
Bctr(2) += 1
Case "Zone 4"
Bctr(3) += 1
Case "Zone 5"
Bctr(4) += 1
Case "Zone 6"
Bctr(5) += 1
Case "Zone 7"
Bctr(6) += 1
End Select
Next a

For b = 0 To 6
If x = 0 Then
Mp(b) = 0
Fp(b) = 0
Else
Mp(b) = Mctr(b) / x * 100
Fp(b) = Fctr(b) / x * 100
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

End If
Next b

For c = 0 To 6
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = ("update tblDPzone set a_BothSexes=" & Bctr(c) &
",a_Male=" & Mctr(c) & ",a_Mpercent=" & Mp(c) & ",a_Female=" & Fctr(c) &
",a_Fpercent=" & Fp(c) & " where a_Zone='" & Zone(c) & "'")
kom.ExecuteNonQuery()
Next

Call LoadRecord(dt, dtset, "tblDPzone", "select * from tblDPzone",


dgvzones)
dgvzones.DataSource = dtset.Tables(0)
dgvzones.ColumnHeadersDefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
dgvzones.DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
''ph1.Rows(0).Height = 40
dgvzones.Columns(0).HeaderText = "Zone"
dgvzones.Columns(0).Width = 200
dgvzones.Columns(1).HeaderText = "Both Sexes"
dgvzones.Columns(1).Width = 150
dgvzones.Columns(2).HeaderText = "Male"
dgvzones.Columns(2).Width = 95
dgvzones.Columns(3).HeaderText = "(%)"
dgvzones.Columns(3).Width = 95
dgvzones.Columns(3).DefaultCellStyle.Format = "##.##"
dgvzones.Columns(4).HeaderText = "Female"
dgvzones.Columns(4).Width = 95
dgvzones.Columns(5).HeaderText = "(%)"
dgvzones.Columns(5).Width = 95
dgvzones.Columns(5).DefaultCellStyle.Format = "##.##"
End Sub

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


btnzonesex.Click
lblinfo.Text = "Distribution of Population According Zone and Sex"
lblmess.Visible = False
Chart1.Visible = False
dgvzones.Visible = True
dgvage.Visible = False
dgveduc.Visible = False
dgvcivil.Visible = False
DPzone()

End Sub

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


btneduc.Click
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

lblinfo.Text = "Distribution of Population According to Edduc'att &


Sex"
lblmess.Visible = False
Chart1.Visible = False
dgvzones.Visible = True
dgvage.Visible = False
dgvzones.Visible = False
dgveduc.Visible = True
dgvcivil.Visible = False
DpEduc()
End Sub
Sub DpcivilStatus()
'compute distribution of population according to Zone and Sex
Dim Mctr(3), Fctr(3), Bctr(3), x, a, b, c As Integer
Dim Mp(3), Fp(3) As Double
Dim EA(3), xcivil, xEA As String

EA(0) = "SINGLE"
EA(1) = "MARRIED"
EA(2) = "SEPERATED "
EA(3) = "WIDOWED"
Call LoadRecord(dt, dtset, "tblResidents", "Select * from tblResidents
", dgvrecord)
x = dtset.Tables(0).Rows.Count
For a = 0 To dtset.Tables(0).Rows.Count - 1
xcivil = dtset.Tables(0).Rows(a).Item(5).ToString
xEA = dtset.Tables(0).Rows(a).Item(8).ToString

Select Case xcivil


Case "Male"
'for Male
Select Case xEA
Case "SINGLE"
Mctr(0) += 1
Case "MARRIED"
Mctr(1) += 1
Case "SEPERATED"
Mctr(2) += 1
Case "WIDOWED"
Mctr(3) += 1
End Select
Case "Female"
'for female
Select Case xEA
Case "SINGLE"
Fctr(0) += 1
Case "MARRIED"
Fctr(1) += 1
Case "SEPERATED"
Fctr(2) += 1
Case "WIDOWED"
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Fctr(3) += 1
End Select
End Select

'for both sexes


Select Case xEA
Case "SINGLE"
Bctr(0) += 1
Case "MARRIED"
Bctr(1) += 1
Case "SEPERATED"
Bctr(2) += 1
Case "WIDOWED"
Bctr(3) += 1
End Select

Next a

For b = 0 To 3
If x = 0 Then
Mp(b) = 0
Fp(b) = 0
Else
Mp(b) = Mctr(b) / x * 100
Fp(b) = Fctr(b) / x * 100
End If
Next b

For c = 0 To 3
kom = New OleDbCommand
kom.Connection = kon
kom.CommandText = ("update tblCivilStatus set a_BothSexes=" &
Bctr(c) & ",a_Male=" & Mctr(c) & ",a_Mpercent=" & Mp(c) & ",a_Female=" &
Fctr(c) & ",a_Fpercent=" & Fp(c) & " where a_Civil='" & EA(c) & "'")
kom.ExecuteNonQuery()
Next c

Call LoadRecord(dt, dtset, "tblCivilStatus", "select * from


tblCivilStatus", dgvcivil)
dgvcivil.DataSource = dtset.Tables(0)
dgvcivil.ColumnHeadersDefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
dgvcivil.DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
dgvcivil.Rows(0).Height = 40
dgvcivil.Columns(0).HeaderText = "Civil Status"
dgvcivil.Columns(0).Width = 150
dgvcivil.Columns(1).HeaderText = "Both Sexes"
dgvcivil.Columns(1).Width = 120
dgvcivil.Columns(2).HeaderText = "Male"
dgvcivil.Columns(2).Width = 95
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

dgvcivil.Columns(3).HeaderText = "(%)"
dgvcivil.Columns(3).Width = 95
dgvcivil.Columns(3).DefaultCellStyle.Format = "##.##"
dgvcivil.Columns(4).HeaderText = "Female"
dgvcivil.Columns(4).Width = 95
dgvcivil.Columns(5).HeaderText = "(%)"
dgvcivil.Columns(5).Width = 95
dgvcivil.Columns(5).DefaultCellStyle.Format = "##.##"
End Sub
Private Sub btncivil_Click(sender As Object, e As EventArgs) Handles
btncivil.Click
Chart1.Visible = False
lblinfo.Text = "Barangay Informations"
dgvzones.Visible = False
dgvage.Visible = False
dgvzones.Visible = False
dgveduc.Visible = False
dgvcivil.Visible = True
lblmess.Visible = False
DpcivilStatus()
End Sub

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


btnprint.Click
If lblinfo.Text = "Distribution of Population According to Age and
Sex" Then
Dim ages As New cragesNsex
dt = New OleDbDataAdapter("Select * from tblDPage ", kon)
dtset = New DataSet
dt.Fill(dtset)
ages.SetDatabaseLogon("Admin", "helloworld")
ages.SetDataSource(dtset.Tables("tblDPage"))
frmRecordPrint.CrystalReportViewer1.ReportSource = ages
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.ShowDialog()
ElseIf lblinfo.Text = "Distribution of Population According Zone and
Sex" Then
Dim zone As New crstatZonesex
dt = New OleDbDataAdapter("Select * from tblDPzone ", kon)
dtset = New DataSet
dt.Fill(dtset)
zone.SetDatabaseLogon("Admin", "helloworld")
zone.SetDataSource(dtset.Tables("tblDPzone"))
frmRecordPrint.CrystalReportViewer1.ReportSource = zone
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.ShowDialog()
ElseIf lblinfo.Text = "Distribution of Population According to
Edduc'att & Sex"
Dim educ As New crEduc
dt = New OleDbDataAdapter("Select * from tblDPzone ", kon)
dtset = New DataSet
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

dt.Fill(dtset)
educ.SetDatabaseLogon("Admin", "helloworld")
educ.SetDataSource(dtset.Tables("tblDPzone"))
frmRecordPrint.CrystalReportViewer1.ReportSource = educ
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.ShowDialog()
ElseIf lblinfo.Text = "Barangay Informations" Then
Dim civil As New crcivil
dt = New OleDbDataAdapter("Select * from tblCivilStatus ", kon)
dtset = New DataSet
dt.Fill(dtset)
civil.SetDatabaseLogon("Admin", "helloworld")
civil.SetDataSource(dtset.Tables("tblCivilStatus"))
frmRecordPrint.CrystalReportViewer1.ReportSource = civil
frmRecordPrint.CrystalReportViewer1.RefreshReport()
frmRecordPrint.ShowDialog()
Else
MsgBox("Unenable to Print!", MsgBoxStyle.Information, "System
Message")
End If
End Sub
End Class
“systemlog of the system
Imports System.Data.OleDb
Public Class frmSystemLog
Dim dgFont As New Font("Cambria", 10)
Dim sDate As String
Dim eDate As String
Dim sTime As String
Dim kom As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim dset As New DataSet
Private Sub frmSystemLog_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
Me.Text = "Activity Log"
Call konneksyon()
DTPfrom.Text = FormatDateTime(Now, DateFormat.ShortDate)
DTPto.Text = FormatDateTime(Now, DateFormat.ShortDate)
Call FilldgLog()
End Sub

Function FilldgLog()
sDate = Date.Parse(DTPfrom.Text).ToString("MM'/'dd'/'yyyy")
eDate = Date.Parse(DTPto.Text).ToString("MM'/'dd'/'yyyy")
kom = New OleDbCommand
kom.Connection = kon
Call LoadRecord(da, dset, "tblSystemLog", "Select * from tblSystemLog
Where ActFDate>=#" & sDate & "# and ActFDate <= #" & eDate & "# order by
ActFDate DESC, ActTime DESC", dgLog)
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

'kom.CommandText = "select * from where ActFDate >= #" & sDate & "#
and ActFDate <= #" & eDate & "# order by ActFDate DESC,ActTime DESC"
'kom.ExecuteNonQuery()
'da.Fill(dset, "tblSystemLog")
'dgLog.DataSource = dset.Tables("tblSystemLog")
lblRecFound.Text = "Record(s) found: " &
dset.Tables("tblSystemLog").Rows.Count
Call FormatdgLog()
Return True
End Function
Function FormatdgLog()
dgLog.ReadOnly = True
dgLog.Font = dgFont
dgLog.ForeColor = Color.Black
dgLog.ColumnHeadersDefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter
dglog.Columns(0).HeaderText = "Logger"
dglog.Columns(1).HeaderText = "Activity"
dgLog.Columns(2).HeaderText = "Date"
dgLog.Columns(3).HeaderText = "Time"
dglog.Columns(0).Width = 150
dglog.Columns(1).Width = 380
dglog.Columns(2).Width = 80
dgLog.Columns(3).Width = 90
dgLog.Columns(3).DefaultCellStyle.Format = "hh:mm:ss tt"
Return True
End Function

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


DTPfrom.ValueChanged
If DTPfrom.Value > DTPto.Value Then
DTPfrom.Value = DTPto.Value
End If
Call FilldgLog()
End Sub

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


DTPto.ValueChanged
If DTPfrom.Value > DTPto.Value Then
DTPto.Value = DTPfrom.Value
End If
Call FilldgLog()
End Sub
End Class

“under security
Imports System.Data.OleDb
Public Class SetTimeLock
Dim m, s As String
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

Private Sub SetTimeLock_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
Call konneksyon()
Call CheckTimeLock()
End Sub

Protected Overrides ReadOnly Property CreateParams() As


System.Windows.Forms.CreateParams
'to disable the alt+f4
Get
Dim cp As CreateParams = MyBase.CreateParams
Const CS_NOCLOSE As Integer = &H200
cp.ClassStyle = cp.ClassStyle Or CS_NOCLOSE
Return cp
End Get
End Property

Function CheckTimeLock()
sql = "select * from SetLockTime"
da = New OleDbDataAdapter(sql, kon)
ds = New DataSet
da.Fill(ds, "SetLockTime")
txtMinutes.Text =
ds.Tables("SetLockTime").Rows(0).Item("Minutes").ToString
txtSeconds.Text =
ds.Tables("SetLockTime").Rows(0).Item("Seconds").ToString
Return True
End Function

Function SaveTimeLock()
If Trim(txtMinutes.Text) <> "" And Trim(txtSeconds.Text) <> "" Then
If Val(txtMinutes.Text) <= 60 Then
If Val(txtMinutes.Text) >= 1 Then
sql = "update SetLockTime set Minutes='" & txtMinutes.Text
& "',Seconds='" & txtSeconds.Text & "'"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
MsgBox("Setting of System lock duration successfull",
MsgBoxStyle.Information, "System Message")
Call Log()
Me.Close()
Else
MsgBox("System lock duration must be minimum of 1 minute",
MsgBoxStyle.Information, "System Message")
End If
Else
MsgBox("System lock duration must be maximum of 60 minutes",
MsgBoxStyle.Information, "System Message")
End If
Else
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

MsgBox("Empty entry/entries not allowed", MsgBoxStyle.Information,


"System Message")
End If
Return True
End Function

Function Log()
Dim currDate As String = FormatDateTime(Now, DateFormat.ShortDate)
Dim currTime As String = FormatDateTime(Now, DateFormat.LongTime)
Dim act As String

act = "Reset system lock duration."

sql = "insert into tblSystemLog values('" & frmMain.Label23.Text &


"','" & act & "','" & currDate & "','" & currTime & "')"
cmd = New OleDbCommand(sql, kon)
cmd.ExecuteNonQuery()
Return True
End Function

Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnOK.Click
Call SaveTimeLock()
End Sub

Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnCancel.Click
Me.Close()
End Sub

Private Sub txtMinutes_TextChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles txtMinutes.TextChanged
If Val(txtMinutes.Text) >= 60 Then
txtMinutes.Text = "60"
txtSeconds.Text = "0"
End If
End Sub

Private Sub txtSeconds_TextChanged(ByVal sender As Object, ByVal e As


System.EventArgs) Handles txtSeconds.TextChanged
If Val(txtSeconds.Text) >= 60 Then
txtSeconds.Text = Val(txtSeconds.Text) - 60
txtMinutes.Text = Val(txtMinutes.Text) + 1
End If
If Val(txtMinutes.Text) = 60 Then
txtSeconds.Text = "0"
End If
End Sub

Private Sub txtMinutes_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtMinutes.KeyPress
Republic of the Philippines
Cagayan State University
www.csu.edu.ph

COLLEGE of INFORMATION and COMPUTING SCIENCES

If Asc(e.KeyChar) = 13 Then
txtSeconds.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String = "1234567890"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

Private Sub txtSeconds_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txtSeconds.KeyPress
If Asc(e.KeyChar) = 13 Then
btnOK.Focus()
End If

If Not (Asc(e.KeyChar)) = 8 Then


Dim allowchar As String = "1234567890"
If allowchar.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End If
End Sub

You might also like