Académique Documents
Professionnel Documents
Culture Documents
FACULTY OF ENGINEERING
UNIVERSITI MALAYSIA SABAH
2017
DEVELOPMENT OF VISUAL BASIC
APPLICATION TO ASSESS CONDITION OF
BUILDING USING CONDITION SURVEY
PROTOCOL (CSP) 1 MATRIX: A STUDY ON
UNIVERSITIES LECTURE HALL
FACULTY OF ENGINEERING
UNIVERSITI MALAYSIA SABAH
2017
DECLARATION
I hereby declare that this thesis, submitted to Universiti Malaysia Sabah as partial
fulfillment of the requirements for the degree of Bachelor of Civil Engineering. This
thesis has not been submitted to any other university for any degree. I also certify
that the work described herein is entirely my own, except for quotations and
summaries sources of which have been duly acknowledged.
This thesis may be made available within university library and may be
photocopied or loaned to other libraries for the purposes of consultation.
CERTIFIED BY
___________________________
Sr Asmawan Bin Mohd. Sarman
SUPERVISOR
iii
ACKNOWLEDGEMENT
This thesis is made possible through the help and support from everyone, including:
supervisor, lecturers, family, and friends. My acknowledgment of gratitude is
expressed toward the following significant advisors and contributors:
First, I would like to thank my Final Year Project Supervisor, Sir Asmawan Bin
Mohd. Sarman for his most encouragement and guidance. He kindly shared his
knowledge with me and explained the detail engineering knowledge and technical
advice to me.
Second, I would like to thank Ms. Farahayni for her utmost helpful guidance
throughout the field work. She kindly guided and heleped me in the progress of site
inspection.
Finally, I sincerely thank my friends. The final version of the thesis would not
be possible without them.
iv
ABSTRACT
Building is major assets whether in public and private sector. Assets can be
maintained not only using huge amount of capital, but also through creative and
effective management. To achieve this, the building has to be managed
professionally. Traditionally, building surveyors have primarily relied on descriptive
longhand surveys. The problem with this method is that it takes considerable amount
of time to record every detail of the building's defect. Thus, new way of describing
building condition for on-site building inspection purpose has been developed. With
this, surveyors are able to conduct on-site inspection at faster ate as there is no need
to write the long description as well as knowing the condition of building instantly by
referring to the building's condition and computing its rating number. However,
computation and the result of the building score still need to be calculated using
hand and can be time consuming. By integrating computer application in condition
analysis process, it can drastically reduce time consumed during this process and
reducing human error in evaluating the building condition itself as there is no need
for manual calculation need to be done. Thus, computer program utilizing CS1 Matrix
was developed to help surveyor to compute and come up with building rating
efficiently. In this study, two lecture halls were inspected using CSP1 Matrix. Data of
both building is then keyed into the developed program. The final result shows that
both building are in Fair Condition.
v
ABSTRAK
Bangunan adalah aset utama sama ada dalam sektor awam mahupun swasta.
Penyengaraan aset bukan sahaja boleh dilaksanakan menggunakan sejumlah
peruntukan yang besar, malah melalui pengurusan kreatif dan berkesan. Justeru
bangunan berkenaan perlulah diuruskan secara profesional. Secara tradisinya,
juruukur bangunan bergantung terutamanya kepada kaji selidik menggunakan tulisan
tangan secara deskriptif. Masalah yang dihadapi apabila menggunakan teknik berikut
adalah ia mengambil sejumlah besar masa untuk mencatat setiap butir-butir
kecacatan bangunan yang ada. Oleh yang demikian, cara baru untuk
menggambarkan keadaan bangunan bagi tujuan pemeriksaan bangunan telah
dibangunkan. Dengan ini, juruukur dapat menjalankan pemeriksaan di tapak dengan
jangkamasa yang lebih cepat kerana mereka tidak perlu untuk menulis penerangan
panjang dan dalam masa yang sama dapat mengetahui keadaan bangunan serta-
merta dengan merujuk kepada keadaan bangunan dan pengiraan jumlah rating.
Walau bagaimanapun, pengiraan dan keputusan skor bangunan masih perlu dikira
dengan menggunakan tangan dan boleh memakan masa. Dengan menyepadukan
aplikasi komputer dalam proses analisis keadaan, ianya boleh mengurangkan masa
yang diperlukan untuk memproses kesemua data secara drastik dan mengurangkan
kesilapan manusia dalam menilai keadaan bangunan itu sendiri kerana tiada
pengiraan tangan yang perlu dilakukan. Oleh itu, applikasi komputer menggunakan
CS1 Matrix telah dihasilkan bagi membantu juruukur untuk mengira dan
menghasilkan keputusan dengan cekap. Dalam kajian ini, dua dewan kuliah telah
diperiksa menggunakan CSP1 Matrix. Data kedua-dua bangunan ini kemudiannya
dimasukkan ke dalam program yang dibangunkan. Keputusan akhir menunjukkan
bahawa kedua-dua bangunan berada dalam Keadaan Sederhana.
vi
CONTENTS
Page
DECLARATION ii
ACKNOWLEDGEMENT iii
ABSTRACT iv
ABSTRAK v
LIST OF CONTENTS vi
LIST OF TABLES x
LIST OF FIGURES xi
LIST OF ABBREVIATIONS xv
CHAPTER 1 INTRODUCTION
1.1 Overview 1
1.2 Definition 3
vii
1.6 Scope of Work 6
2.1 Introduction 9
viii
2.4.2 Acoustics 31
2.4.3 Lighting 32
2.4.4 Seating 32
CHAPTER 3 METHODOLOGY
3.1 Introduction 44
3.3.4 Deployment 58
3.4 Analysis 59
4.1 Introduction 60
ix
4.2 Developed Application / Software 60
5.1 Introduction 80
5.2 Conclusion 80
5.3 Limitation 81
5.4 Recommendation 81
REFERENCES 82
APPENDICES
x
LIST OF TABLES
xi
LIST OF FIGURES
2.1 Compilers turn source code from high level language into 10
instruction that the computer can understand.
xii
3.5 Adding New Item into Empty Form. 51
xiii
4.7 Form 6 (edit defect window). 66
xiv
LIST OF SYMBOLS
Wave Speed
Integration constant
xv
LIST OF ABBREVIATION
AV Audio-Visual
dB Decibel Level
xvi
OSH Occupational Safety and Health
RH Relative Humidity
RT Reverb Time
VB Visual Basic
xvii
CHAPTER 1
INTRODUCTION
1.1 Overview
public and private sector. Assets can be maintained not only using huge amount of
capital, but also through creative and effective management. To achieve this, the
surveys (Che-Ani et al., 2010). The problem with this method is that it takes
considerable amount of time to record every detail of the building's defect. Using this
description method, the surveyor only able to describe the condition of that particular
their feels. In relation, surveyor will describe more towards their own past
experience which is limited to what they are experiencing during their career. The
new surveyor to assess any property or asset condition as it requires their judgment,
1
However, new way of describing building condition for on-site building
inspection purpose has been developed. As mentioned by Hamzah et al., (2010) this
description are now gaining wide acceptance in industry. This is due to the fact that
the new system caters to the need for numerical analysis output. In addition, the
utilization of rating also able to save time during inspection on site as surveyor only
In recent study, new system has been developed that can unify the numerical
output and still employ numerical analysis method. The development of Condition
Survey Protocol (CSP) 1 Matrix has been proven to be effective by researcher. Study
conducted by Hamzah et al., (2010) shows that CSP 1 Matrix able to save on-site
time during building inspection in addition to employ score numerical analysis that
be done with more precise and quick; data will be able to be present instantly as
the end result achieved is considered quick and precise, the system still requires
more effective, thus the utilization of computer application must be considered. Using
computer application, surveyor will not only able to get result quick and precise, but
also can reduce error during computation. Thus, the purpose of this study is to
develop a windows application that utilize Condition Survey Protocol (CSP) 1 Matrix to
assess the condition and performance of lecture hall building of learning institution
Microsoft Windows operating system, also called a Windows app. There are several
popular language for windows programming but the most common language for
windows application are visual basic, C#, C++ and Python. All 32-bit Windows
applications run in the 32-bit and 64-bit versions of Windows. Using Visual Studio,
Windows application can be created and build using one of these languages. A Visual
Studio Windows application is built around the .NET Framework, a rich set of classes
instead of description to achieve the need for numerical analysis output. The system
relies on buildings condition and assessment to obtain the total score of the building
inspected. The total score indicates whether the building is in good condition or the
property in the various stages of construction, to ensure the builder has complied
with all requirements of the local building codes. Failure to pass a particular
inspection may halt progress until the condition has been corrected. For example,
construction may proceed on a building until it has passed its foundation inspection.
Building inspection is not only conducted for ongoing building construction and newly
3
constructed building, but also can be conducted to assess current condition of
buildings.
ensures that there is a structured, objective process for identifying the demand for
over the immediate, medium and long term. In addition to that, it also helps to show
the needed existing maintenance program that would be put onto the building in
condition of a building is the typical way to measure the building performance (Abbot
et al., 2007). Condition assessment also allows surveyor to know the building
performance as the condition of the building becoming the measurement marker for
the physical condition of the building. That is the reason why condition of a building
becoming the measurement marker for building performance. (Wahida et al., 2012).
Kota Kinabalu can be assessed and the numerical result of the buildings condition
can be produced. After obtaining building condition through CSP 1 Matrix, it is the
4
use as measurement marker to obtain the performance of Lecture hall studied
are time consuming, particularly during site inspections (Che-Ani, A. I. et. al, 2010).
The problem with this method of assessment is that the time needed to write all the
Edition Practice Notes), surveyor able to conduct on-site inspection at faster rate as
there is no need to write the long description as well as knowing the condition of
building instantly by referring to the building's condition and computing its rating
number.
However, computation and the result of the building score still need to be
during this process and reducing human error in evaluating the building condition
itself as there is no needed for manual calculation need to be done. Thus, the need
to develop a Windows application that can calculate and produce result automatically
CSP 1 Matrix is a newly developed system that was designed to evaluate the
condition of building and it utilizes rating and descriptive information to get building
score for condition assessment. For the past few years, researchers use CSP1 Matrix
5
to evaluate condition of public buildings such as toilet, school, and so on. Though the
case, the new matrix system have not been tested on lecture hall. Thus, more study
assets. With condition assessment, owner can work out the condition of their assets
and take action to maintain that assets. Although condition assessment is the best
way to know assets condition, the evaluation of building in Malaysia especially lecture
hall has not been formally developed. There is no parameter or system to assess the
on CSP1 Matrix.
Dewan Kuliah Awam of Politeknik Kota Kinabalu and using CSP1 Matrix.
c) To obtain and compare overall building rating for several lecture hall of
The application development will be done using Microsoft Studio Community 2015
software. The reason of choosing this application is because it is available for free on
the internet in addition to having huge community that help developer to come up
with a solution.
6
Several lecture halls with from different learning institution (Politeknik Kota
Kinabalu & Universiti Malaysia Sabah) will be chosen for the assessment which has
the highest occupancy per day. Lecture hall is chosen for this project because of its
Three aspects will be assessed for the evaluation of condition. The first one is
buildings exterior, second is the building interior and the third one is services. Score
will be calculated for these three aspects using the developed application. Lastly,
condition of all lecture halls will be determined and results will be presented in tables
and charts.
i) Developing hypothesis.
7
INTENSIVE READING FOM READING JOURNALS:
Emerald Insight
World Academy of Science
Science Direct
RESEARCH GAP
Windows Application for assessing building condition using CSP 1 Matrix not been
developed.
No study on evaluation of lecture hall performance has not been developed using
CSP 1 Matrix.
Assessment of lecture hall of universities using CSP 1 Matrix not been evaluated.
OBJECTIVES
Developing Windows Application by
integrating CSP 1 Matrix to assess and Work TITLE
to obtain overall rating of Lecture hall of Development of Visual Basic Application To
Assess Condition of Building Based on
Universities.
Condition Survey Protocol (CSP) 1 Matrix: A
Study on Universities Lecture Hall.
METHODOLOGY
1. Develop Windows application that utilizes CSP 1 Matrix.
2. Acquire data for the evaluation of lecture hall via inspection work.
3. Data of lecture hall evaluated is then computed using the application.
4. Summary of findings such as number of defects, total score and overall building rating will be produced
based on result computed by the App.
5. Comparison will be presented using tables.
Pilot Test
1. Reliability of
Instrument Sampling Technique Data Analysis
Visual Studio to
create App. 1. Lecture Hall. 1. Windows
1. Microsoft Visual
2. Compatibility of Studio 2. Nearby Universities or Application
Windows education institution. 2. CSP 1 Matrix
2. Binocular
computer.
8
CHAPTER 2
LITERATURE REVIEW
2.1 Introduction
The vast growth of the development of computer application software has brought a
new field of interest to the public as with the aid of computer software application,
daily and routine works will be easily conducted a lot faster and efficient. Integrating
the use of computer software application into the works of building inspection will aid
a lot in terms of processing data for calculation purpose, storing large data as well as
producing a reliable output will cut the time cost in performing building inspection.
This development will be of much contribution towards the research of finding the
a computer can executes (Combs T. & Campbell J., 2001). Saved in one file, these
should do its job (Van-Roy P, 2003). In other words, programming also means
designing a set of instructions to instruct the computer to carry out certain jobs that
are very much faster than human beings can do. At the very basic level, the
microprocessor, the brain of the computes, converts the instructions into electrical
9
signals that perform operations such as adding two numbers or moving data around
the computer's memory (Combs T. & Campbell J., 2001). In addition to handling
also can perform many other tasks like accepting, sorting, selecting, moving and
data.
compiled into a program. The way computer do this is by translating these sets of
instruction into a native code. The process of translating these instructions is called
compiling. The programs that do this translation are called compilers (Mackanzie D. &
Sharkey K., 2002). After the program finish compiling, it would then produce a
program is then run and test for errors. If errors persist, it would then go back to
text editing to make changes to the code. The code would be compiled again, and
the cycle would repeat (Mackanzie D. & Sharkey K., 2002). The development process
(Figure 2.1) was a common activity for all programmers and was not language
specific.
Create / Edit
Execute
Figure 2.1:Compilers turn source code from high level language into
instruction that the computer can understand.
Source: Mackanzie D. & Sharkey K. (2002)
10
As programming languages have evolved, this development cycle has been
K., 2002). The concept of IDE means to combine the editing, debugging and
programmers.
environment for users to work in, but it still uses the same sequence of
it can create run and debug program written in multiple programming languages.
Visual Studio.
Visual Studio
Integrated Development Environment
however, more and more languages are added into the IDE. Languages included in
recent version of Microsoft Visual Studio are CSS and JavaScript. Each Visual Studios
language (Ekedahl M. V., 2004). This will give benefits to programmers as they can
choose language that is familiar to them without losing the functionality they need.
The performance of language inside Visual Studio is also nearly identical, so again,
Over the years, many version of Visual Studio were released by Microsoft with
addition of new features along the way. In addition, syntax and implementation of
the supported languages have evolved considerably too. Some of the improvements
are significant than others. For example, no matter what language the programmer
chose, it shares the same IDE. All Visual Studio languages share the same integrated
development environment (Ekedahl M. V., 2004). Other than that, several debugging
windows and tools were added making it easier to fix errors. Moreover, overhauled
deployment tools gives option to user to install parts of an application and customize
tools were overhauled, providing a developer the means to customize the setup
application run by user on their target computers (Ekedahl M. V., 2004). This means
that programmers or user can install optional parts and customize based on their
computer setup. However, all the new useful features added in newer version of
Microsoft Visual Studio can lead to another issue. The creation of IDE has led to
some confusion between what is a feature of the language being used, and what is
12
the feature of the IDE (Mackanzie D. & Sharkey K., 2002). In case of Visual Basic
language, IDE provides many futures than enable a programmer to easily create
advance functionality that blur the underlying language. Thus, in order to create a
The old definition for programming language is "a notation for communicating to a
task (Louden K. C., 2003). To instruct these computers, early computer programmers
language uses binary codes comprises 0 and 1 to communicate with the computer.
Machine language is the sequence of bits that directly control a processor, causing it
to add, compare, move data from one place to another and so forth at appropriate
times (Scott M. L., 2009). By combining 1's and 0's, different number can be
represented (Salvage J., 2003). Programming these machines was difficult because
these numbers were not entered in common decimal form but in encoding scheme
called binary numbers (Salvage J., 2003). As programs became larger, programmers
wrote all found it impractical to work in terms of computer's 1's and 0's (Combs T. &
13
Fortunately, scientists have invented high-level programming languages that
are much easier to master. Some of the high-level programming languages are Java,
C++ and Visual Basic. High-level programming languages like C++ allow
C++, Java and Visual Basic are the three most popular programming languages.
Although some of languages are preferable than other, there are no right or wrong
answer in which language a programmer use. With complete IDE developed over the
preference. Table 2.1 shows brief difference between these three popular
programing languages.
14
C++ programming language is known to be very efficient in world of
processing heavy software. In this study however, it is not necessary to have the
extra speed. Besides, due the complex language of C++, learning curve is steep.
language is also a complex as it is derived from C++ itself. Due to time constraint,
Visual Basic will be chosen for this study as it not only proven to be efficient and
quick programming language, but also die to the fact it has all the function needed
Visual Basic (VB) is a high level programming language that evolved from the earlier
DOS version called BASIC. BASIC was developed in 1964 by John Kemeny and
Thomas Kurtz (at Dartmouth College) as a language for the rest of us (Salvage J.,
2003). BASIC means Beginners All-purpose Symbolic Instruction Code. The Visual
Symbolic Instruction Code) (Davis H., 2003). Just like Visual Studio IDE, Visual Basic
Language also evolving and becoming more advance throughout the years. Each
successive version of Visual Basic added new features, making it more and more into
a fully capable development tool (Mackanzie D. & Sharkey K., 2002). Visual Basic is
(Kent J., 2002). Although Visual Basic .NET has BASIC in its name, they are
completely in different world all together as Visual Basic .NET is developed baars little
regardless of the environment that hosts it. However, VB, Microsoft Office suite, and
15
a number of other applications share a common programming language named VBA
Microsoft Visual Basic .NET for Windows (VB .NET) allows Engineers to
& Andes J. L., 1995). This is beneficial as Windows operating system is flexible and
easy to use. With Visual Basic, engineer can quickly create simple programs based on
user interface is easy to do and there is a growing base of users and add-in
applications (Torres D. E. & Andes J. L., 1995). Visual Basic is a powerful, graceful,
fully object-oriented modern language, every bit the equal of C# or Java (Davis H.,
simple to use. Visual Basic somehow manages to preserve the simplicity of syntax
that always been hallmark of BASIC family languages (Davis H., 2003).
In Visual Basic .NET, programmers only need to drag and drop any graphical
object anywhere on the form and click on the object to enter the code window and
the user via the control on the form. The events usually comprises but not limited to
the user's inputs. Some of the events are load, click, double click, drag and drop,
pressing the keys and more (Liew V. K., 2014). Modern programming languages
allow the programmer to quickly design screen panels and easily reuse code (Torres
D. E. & Andes J. L., 1995). Because of the functionality that Visual Basic language
developed over its generation and the simplicity that remains, Visual Basic language
the physical state of building elements and services and to assess the maintenance
needs of the facility. Reliable and objective knowledge of the physical state of their
buildings and the impacts on service delivery will enable departments to develop
asset failures, shorter useful asset lives, higher repair and replacement costs, all of
and repairs needed for existing components, fittings and physical of the building. It
also useful in order to rank the amount of repair and cost needed. It requires some
planning (Wahida R. N., 2012). Singh, A. S. (2008) stated that there are about four
17
Asset Hierarchy Evaluation Mechanism
different categories. For example, a building can be divided into different disciplines
or systems (electrical, mechanical, etc.), that can be further divided into more
detailed component level (interior doors, exterior doors, windows, ceiling, etc.)
18
A study by Elhakeem (2005) combined the benefits of existing hierarchies and
educational organizations (e.g. school boards). The main benefits of the proposed
Much research has been directed towards identifying proper evaluation criteria in
order to assess the performance of building components (Chew et al., 2003). The
2002). Uzarski reported that the distress survey procedure is an accurate and
inspected instance. The direct-condition rating approach is less accurate but much
In any system, the values of the condition indexes provide the means of
comparing the condition of various components. The condition index scale for
condition and 100 represent a new condition (Singh, A. S., 2008). However, some
other rating system (Hamzah N., 2010) incorporate opposite scale indexing, where 0
represents a new condition and 100 represent a critical condition. No matter which
19
numeric scale is used, a linguistic representation can be derived from the numeric
values, as in the example from BUILDER, shown in Figure 2.4 (Uzarski D. R. & Burley
Elhakeem and Deterioration: (0 - 20) = no, (20 - 40) = slight, (40 - 60) =
Buildings 1-100
Hegazy 2005 moderate, (60 - 80) = severe, and (80 - 100) = critical
20
2.3.3 Field Inspection and Data Collection
Evaluating the condition of building components using a distress survey requires full
crucial. The goal of the inspection process is to obtain the data required in order to
checklists and deficiency lists for inspection during identification of asset hierarchy
process. These lists can be in either paper or electronic format (Singh, A. S., 2008).
building and lastly, interior of the building. First, external building conditions are
descending order starting from the roof as external defects may affect the interior of
the house. Similarly, defects at the top level of the building may influence the lower
levels. In addition, all elements in the building need to be inspected thoroughly based
21
2.3.4 Condition Analysis
After obtaining data by the inspection process is in the form of measurements of the
calculated, the value can be used to calculate the condition at any level in the asset
hierarchy (condition aggregation). The inspection data is analysed based on the type
If the evaluation used the direct-rating method at the system level, an index
is calculated for the whole facility: the Facility Condition Index (FCI). The FCI is
The cost to correct deficiencies equals the estimated total costs to repair all
replace an existing structure with a new structure of the same size at the same
22
2.3.5 Condition Survey Protocol (CSP) 1 Matrix
The CSP1 matrix was primarily developed as a rating tool for a reasonable property
condition assessment. However, because of the data input relies on the condition and
damage assessments, CSP1 matrix are also suitable for all types of buildings.
matrix will still able to accommodate any condition of survey work. The goals of CSP
1 Matrix are:
ii) To record the existing defects of the building, the main source of data, by
iii) To obtain an overall rating of the buildings condition. The proposed remedial
work is not the main concern of this matrix. Moreover, the repair work usually
budget constraints.
iv) To use the numerical rating acquired from the survey work to perform
statistical analysis.
There are two data required for the CSP 1 Matrix which are the condition and
the priority assessment. Like previous rating scale, CSP 1 also incorporates numerical
score and linguistic representations. The scale values and their descriptions depend
on the maintenance standard of the building being evaluated. For instance, the scale
can be made more stringent than the example provided here. The examples given in
Tables 2.3 and 2.4 are the most basic scales used in the CSP1 Matrix (Hamzah et al.,
2010).
23
Table 2.3: Condition Assessment Protocol 1.
Each recorded defect is assigned with a condition and priority rating. Each
rating is then multiplied to determine the total score for each defect. The total score
which ranges from 1 to 20 is then matched with the matrix, as shown in Figure 2.5. A
colour (green, yellow or red) is then applied to indicate the score in each of the 3
24
Figure 2.5: The Matrix.
Source: Hamzah et al. (2010)
2 Condition Monitoring 5 to 12
3 Serious Attention 13 to 20
After scoring every defect, the overall building rating which summarises the
adding all scores and dividing to number of elements. The building is then rated
Good, Fair or Dilapidated, according to the score (out of 20) (Hamzah et al., 2010).
1 Good 1 to 4
2 Fair 5 to 12
3 Dilapidated 13 to 20
26
2.4 Lecturer Hall
Lecture hall also known as Lecture Theater is a large room associated with education
house 1 to 50 students. However, the number student housed in lecture hall often
designed for more than 75 students are considered lecture halls. While looking on
Facilities and Service Standard of University of Illinois (2013), it is stated that any
general assignment classroom with a seating capacity above 120 seats is considered
a lecture hall or theater. Even so, the sole purpose of lecture hall remains the same.
The performance of lecture hall relies on its ability to help deliver a good
lecture with maximum effectiveness. According to Jago & Tanner (1999) physical
environmental elements such as lighting, heating and acoustics are three aspects
of lecture hall, few characteristic related to requirements of good lecture hall need to
to design better lecture hall, but also helps to define distractions that can hinder the
learning and instructional process so that the distractions are eliminated or at least
minimized.
27
2.4.1 Types of Lecture Hall
The type of lecture hall can be generalized mainly by its seating arrangements. There
a maximum of 14-16 chairs per row with access to an aisle-way at both ends. If an
aisle can be reached from one end of a row only, the seat count may then be limited
to 7 or 8. For continental arrangement on the other hand, all seats are located in a
central section. Here the maximum quantity of chairs per row can greatly exceed the
greater length of rows allowed, building codes will require wider row spacing, wider
aisles, and strategically located exit doors. Figure 2.8 and 2.9 shows the difference
28
Figure 2.8: Continental arrangement
Source: Theatre Solution Inc. (2016)
spectators and performers dictated by the anticipated function or use. The commonly
used forms for lecture hall (as shown in figure 2.10) are the End Stage, Wide Fan,
Arena and Arena. Each form has its unique advantages and disadvantages. Table 2.7
shows the advantage and disadvantage of each form. Another aspect that governs
type of lecture hall is floor design. Much like arrangement and form, there are two
types of floor design, flat and sloped floor. Flat or less steeply sloped floors will
usually allow a person to extend their knees and legs even under minimum row
spacing conditions. Here, an individual can take advantage of the open area under a
seat and the free space created by the pitched back of a chair. As the floor slope is
increased, this free space diminishes. The extreme condition exists where a large
elevation change between rows is combined with a minimum row spacing (Theatre
30
2.4.2 Acoustics
enhanced by a classroom with ideal acoustics (Bauman E. & Averett, 2008). As the
is important to assess the situation and promote the lecture halls environment which
R. S., 2014). The experiments that are frequently used to test classroom acoustics
focus on a Speech Intelligibility Index (SII) ranking system, which ranges from zero
(the worst) to one (the best) (Bauman E. & Averett T., 2008). The SII can be broken
down into many components including reverb time (RT), decibel level (dB) changes
throughout the seating area, ambient background noise, and the volume of the room
speech, etc., then radiates in waves in all directions from a point source until it
encounters obstacles like walls or ceilings (Seng L. K., 2011). However, when the
sound wave encounter obstacle, some of the sound may be transmit, absorb, reflect
and defuse by the obstacle. Sounds that are reflected can cause echo that ultimately
affect lecture hall performance. Harder, denser materials tend to bounce sounds
around the room, while materials that are less dense tend to absorb more sound
(Bauman E. & Averett T., 2008). Materials such as carpets, acoustic tiles, curtains,
cotton and fiberglass has high absorption coefficient for mid and high frequency band
while panel and membrane can be used to absorb low frequency band as stated by
Elkhateeb A. A. (2012).
31
2.4.3 Lighting
Lighting has its own impact in learning performance. Research has shown that good
A. (2012), show that good lighting classrooms can motivate students for better
and artificial light in classrooms will motivate students to learn more and it will
improve their performance (Samani S. A., 2012). To get visual comfort, IES, CIBSE
and DIN EN 12464 recommended minimum general lighting illumination 500 lux for
lecture theatre 500 lux and 750 lux for demonstration area (Wasilah J. P., 2013). In
addition, Lighting should be uniform throughout the room and flexible to allow for
multiple teaching modes. Types of light are also important as it creates the quality of
light itself. Results of this study can provide guideline in designing good lighting to
2.4.4 Seating
was found that seating position could have an effect on the students performance in
the lecture hall. Classroom experience and education literature suggest that students
who sit in the front of a lecture hall are more likely to get As than students in the
back (Benedict 7 Hoag 2004; Holliman 7 Anderson 1986; Pedersen 1994). Perkins
and Wieman (2005) recently challenged this dogma by showing that students sitting
Physics of Everyday Life) received better grades than students in the back, even
though seats were randomly assigned at the beginning of the course. Seat location
32
as well as seat quality is important in helping student to focus better during lecture.
This information can be used to help in designing lecture hall seating plans that
Thermal comfort (TC) involves control of temperature, humidity, air motion and non-
environmental factors such as dress and activity level of the occupants (McQuiston et
al., 2005). Heat gain or loss beyond this will generate a sensation of dissatisfaction
(Yau et al., 2011). Thermal comfort can affect students performance as it leads to
lecture hall, thermal comfort of the lecture hall must meet to the requirement and
for Human Occupancy specifies thermal conditions which will be acceptable to 80%
Standard 55(2004) on the other hand, the acceptable operating temperatures and
humidity in summer (light clothing, 0.5 clo) are 24-28C with 30% RH and 23-25.5C
Audiovisual (AV) means possessing both a sound and a visual component, such as
slide-tape presentations (Barman C., 1984). Lecture hall are designed to effectively
communicate to a large audience of students whilst keeping them engaged. The use
theatres due to the ability to control visual imagery and sound simultaneously for the
33
(electronic) teaching theaters have been installed in many universities and colleges
all over the world. These installations typically include high quality projection of
interaction on the part of the students (Hoppe et al., 1999). Lecture hall combines
audio visual equipment to deliver and stimulate students on a visual and intellectual
level. Large screen projectors can be used in conjunction with interactive panels to
allow the lecturer to truly engage. Ensuring fully functioning AV system is important
For the purpose of building inspection, every element of the building need to be
study. Building elements of Lecture hall can be divided into 4 categories; exterior,
interior, services and substructure. Each element in each category plays an important
I) Exterior
Examples of exterior element for lecture hall are external walls, roofs, doors,
windows and etc. Building exterior is often referred to building envelop. The main
purpose of exterior elements for lecture hall is to protect lecture hall from outside
changes such as weather that could effect and deteriorate the building.
building from outside element such as weather and animals that may damage the
building. A criterion external wall must have includes fire resistance, weather
resistance, strong and stable. An optional criterion of external wall for lecture wall
34
is that it must have a good sound insulation. Different material of external wall
can affect the building performance. The typical external wall material used for
lecture hall are concrete, brick stone and glass depending on the purpose and
feasibility of the wall Following are the typical material for external wall:
by using other inert materials, such as sand, stone chips, brick chips, brick
chips, pebbles, gravel, shale, etc. with water and allowing the mixture to
and can withstand huge load. This is beneficial for constructing load
bearing wall.
ii) Brick Brick is one of the famous construction materials for walls. Brick
The types of brick commonly used for wall construction are common brick,
face brick, engineering brick. Face brick is used to give good finish to
walls while engineering brick is used for load bearing wall. Brick such as
hollow brick and key brick are made with hole and indentation to ensure
building envelop, it also provide shelter from animal and weather, notably rain
and also heat, wind also sunlight. Depending to the purpose and size of a
building, shape of roof can vary. Because of the large area of lecture hall, the
35
common roof shape used for lecture hall must be able to cover the large area of
lecture hall. Examples of roof shape that can cover huge area are flat roof, mono-
pitched roof, dome and etc. Material with highly impermeable properties as roof
is used as covering. Example of roofing material used for lecture hall are:
i) Metal A metal roof offers protection from the elements and relatively
little maintenance with a lifetime that can exceed 40 years. Metal roofs
can be treated with reflective surfaces to help reflect heat without high
cost. Advantage of using metal roofing material is that it doesnt need the
used, but are also 100% recyclable at the end of their life as a roof.
blocking ability. They are a long lasting roofing material but the material
Polycarbonate is that, they are resistant to heat, sunlight, snow, and rain,
which enable them to last for many years without fading or discoloring.
the material reflects sunlight and heat better than almost any other
iv) Glass While glass is not usually considered when choosing roofing
materials, this material can be a great way to bring light and a sense of
spaciousness into the home. Colored or clear glass light panels in the roof
36
offer an attractive and eco-friendly way to brighten the interior of your
home naturally.
c) Doors, Windows and Joinery Door and window are a moving structure used
space. Door and window has an interior inside space and exterior side that face
Toronto, Doors opening into classrooms of all types are to be a minimum of 915
mm (30) wide. In the case of double doors, each entrance will have at least one
leaf that is 915 mm (30) wide. For lecture room with the capacity greater than
other hand are normally fixed or with hinges or even sliding. Window treatment
on the other hand, is usually performed in order to obtain opaque properties that
enable it to eliminate outside light form teaching and projection screen. Materials
for the frame of door and window can vary depending on the specification.
joinery with simple hand tools. Some of advantage of using wood is that
the maintenance of the wooden frames is easy and cheap. Other than
ii) Aluminum Light yet strong, aluminum windows and doors can be
iii) Fiberglass Fiberglass doors might present you with a higher up-front
cost when compared with traditional wood and metal, but in the long run,
37
the benefits will surpass that initial investment. Fiberglass doors and
window frame can be produced to look alike wood, and even a door
d) Trench drain and Gutter Trench drain and gutter is usually constructed and
can be found outside of building or building exterior. Both drainage and gutter
link together as they are constructed with the purpose of catching and conveying
surface and sub-surface water from an area. Usually made from concrete,
60cm in width and 120 cm in depth. There are usually two shapes of
trench drainage for lecture hall, which are semi-circular cross-section and
rectangular cross-section.
ii) Gutter Also known as rain catcher, gutter is a narrow channel forming
the component of roof system, which collects and diverts rainwater away
from the roof edge, usually diverting to trench drain. Depending on design
of a building, rain gutter can be placed either along the lower edge of roof
roof.
38
II) Interior
wall and ceiling is that they must be able to absorb sound in order to give maximum
learning performance.
lecture hall are brick and concrete. However, brick and concrete are dense and
hard materials. As established, when sound wave hit dense and hard material, it
will bounce and creating echoes. To minimize this, sound dampening must be
center.
b) Floor There are two types of floor, pitch and flat. Floor of lecture hall is made
from concrete slab. Normally, the concrete slab is finished with sound
dampening materials such as carpet. Carpet allows sound wave to dissipate thus
reducing echoes throughout the entire lecture hall. However, some lecture hall
uses typical finishing material for floor such as tiles, and laminate.
olefin and polyester. Typically last for 15-18 years, carpet is usually used
39
indoors in both high and low traffic areas. Twist carpet is composed of
multiple twisted fibers set into the carpet backings. While looped carpets
iii) Tile Floor tile are commonly made from ceramic or stone. Floor tiles
are typically set into mortar consisting of sand, sand and other additive
for extra adhesion. Traditionally, the spaces between the tiles are filled
grout.
Ceiling ceiling in lecture hall must be fitted with sound reflecting elements above
that it can reach the audience. Thus, materials used for ceiling must be able to
reflect sound wave. Sound reflecting material such as hard wood, and other dense
materials are used. Typically, lecture hall incorporates hanging ceiling to hang these
III) Services
efficient and safe. Examples of services inside a building are lighting (natural &
artificial), faade engineering, escalators and lift. Depending on type and usage of
building, services provided the building might vary. In lecture hall, there are several
40
services can be found. Some of the services can be found in lecture hall are; lighting,
lecture hall. Lighting allows audience to see clearly and focus on the lecture
given. Light can come from artificial (light bulb) and natural (sunlight). Artificial
light usually placed or fixed on the ceiling of lecture hall. This allows better
illumination to user.
through a small transparent lens, but some newer types of projectors can
ii) Speaker A speaker is a term used to describe the user who is giving
are fixed using bolt in front of lecture hall by its support structure.
c) Air condition Air condition is important to keep the optimum level of comfort
especially during hot day. Air condition is used in lecture room in order to
remove heat from the room and removing humidity. Thus, by installing air
several installation types for air condition; Window unit or packaged terminal,
installed in an open window. The interior air is cooled as fan blows it over
the evaporator. On the exterior, the heat drawn from the interior is
dissipated into the environment as a second fan blows outside air over
the condenser. Similarly, packed terminal air conditioner works the same
rooms as it typically split the indoor unit allowing the compressor and
system.
IV) Substructure
Substructure is the lower portion of the building, which transmits the dead load, live
loads and another load from super-structure to the underneath of sub soil.
There are two types of foundation, which are shallow and deep foundation.
Shallow foundation transfers load near to the top of surface. There are various
types of shallow foundation, which are pad footing, cantilever or strap footing
and wall footing. Deep foundation on the other hand, founding deeply below the
ground surface. The common type of deep foundation is pile foundation and
b) Tie Beam or grade beam Tie beam or grade beam does not carry any
movement, hence the name. However when ground slab rest on tie beam, it will
then carry vertical loads. In this case, the tie beam is no longer called tie beam.
43
CHAPTER 3
METHODOLOGY
3.1 Introduction
Before project begins, preliminary research was conducted in order to identify the
flow for the whole development of project. Figure 3.1 shows the flowchart for the
i) Identifying Problem
v) Deployment
software and applying to real world data will be outlined. Thus, there are few topics
will be discussed regarding process mentioned which comprised of; acquiring real
programming, testing and lastly, analysis. Overall, there are 5 phases towards the
44
Real world data will be acquired by the process of site inspection & data
software construction and design phase on the other hand is the most important
phase in the project. Before coding can begin, information about the building and
assessment matrix are mandatory in order to integrate them into the programming
software designed. After software construction and design is completed, testing and
analysis phase will take place. Theoretically, these two phases should not be
45
Title of Project
Objectives
Problem Statement
Planning
Methodology
Acquiring Data
Literature
Review Design of CSP 1 Program
Testing
Analysis
Result
Conclusion
46
3.2 Acquiring Real World Data
Real world data Will be acquired by conducting site inspection and data collection.
For this project, two lecture halls are chosen to assess its condition using CSP 1
Matrix integrated in the program itself. The two lecture halls chosen are Dewan
Kuliah Pusat 1 (DKP1) of Universiti Malaysia Sabah (UMS) and Dewan Kuliah Awam
site inspection conducted in there steps or flow. Building inspection will be conducted
from outside perimeter, to external of the building and lastly, interior of the building.
Buildings are generally inspected in descending order starting from the roof as
external defects may affect the interior of the building. Similarly, defects at the top
from front to the left side of the building, circling both inside or outside of the
building until arrive back to the starting point. This will minimize error during site
inspection and data recording process. For safety reason, binocular will be used to
spot defect on high, inaccessible places. All elements in the building need to be
therefore simplify the determination of possible causes of internal defects. The defect
will be recorded; the location will be systematically labeled and marked on the
47
3.3 Software Development
existing program. Acting like a blueprint, workflow diagram will help translate written
strategies into a format that any employee can understand. A waterfall model is a
downwards (like a waterfall) through several phases. For this project, waterfall model
will help guide the whole development phase. Shown in Figure 3.2 is the waterfall
Identifying
Problem
Programming
Software
Design
Implementation
and Coding
Program Testing
Deployment
48
3.3.1 Program Software Design
Since the first phase of program development was discussed in previous chapter, the
phase is considered completed and now will proceed to phase 2 of the software
software is designed to meet the end user requirement. Requirement was studied to
help specify the hardware system requirement in addition to define the overall
thorough in previous chapter, sequence of the way the program needs to run can be
help of a diagram, the sequence of what the program must follow can be illustrated.
Figure 3.3 below shows the operating sequence for CSP 1 matrix program.
List of building
elements
Condition of each
building elements
Assessment of
each building
elements
Determination of
score of each
building element Score of all building
elements are
Overall
Rating
49
3.3.2 Implementation and Coding
To integrate CSP 1 matrix into a program requires the understanding of the matrix
itself and building elements for lecture hall. In Chapter 2, both CSP 1 matrix and
lecture hall have been studied and understood. Thus, the implementation of the
matrix system for lecture hall can be integrated easily into the program.
The implementation and coding stage starts with creating new project in
Microsoft Visual Studio. Figure 3.4 shows the New Project window.
After new project is created, an empty application form is filled with all the
required tools by dragging and dropping the required tool from the toolbox into the
Figure 3.5 shows an empty application form design and tools available.
50
Figure 3.5: Adding New Item into Empty Form.
From there, code is assigned to the form and specific tool in order for it to
work as the user intended. When assigned to the form, the code will execute as soon
as the form is opened. When assigned to a button, the code will execute as soon as
the button is pressed. Figure 3.6 shows the code editing window.
51
In order to achieve the requirement of displaying information in the program,
connection code as shown below is used in for the program to connect with the MySql
Sever. This code allows the program to access spesific database inside the sever using
In order display information of the selected database from MySql sever, The
data must first be selected by using a query id used telling MySql sever to select data
which data from the database. Code in Figure 3.8 is used to select all information in
fill. The code shown in Figure 3.9 is used to display selected data into a DataGridView
table. To display data in textbox on the other hand, the code in Figure 3.10 is used.
52
Dim sda As New MySqlDataAdapter
Dim dbdatatableas As New DataTable
Dim dbsource As New BindingSource
sda.Fill(dbdatatableas)
dbsource.DataSource = dbdatatableas
DataGridView1.DataSource = dbsource
da.Fill(ds, "Subject_Detail")
txtDescription.Text = ds.Tables(0).Rows(0).Item(0)
txtName.Text = ds.Tables(0).Rows(0).Item(1)
labelScore.Text= ds.Tables(0).Rows(0).Item(2)
Displaying image in an image box is different from other data. This is because the
data need to be translating from binary file into presentable image file. Due to this,
following code is used to change LONGBLOB binary data to image data using memory
img = ds.Tables(0).Rows(0).Item(3)
Dim ms As New MemoryStream(img)
Photo1.Image = Image.FromStream(ms)
53
For all the data that is displayed, all the data must be keyed in in the first place. To
do so, an INSERT TO query is used in the program to let the sever know the data
user want to save. Code in Figure 3.12 is used to save data such as condition,
However, before the image file can be saved into MySQL database, it needs to be
converted into LONGBLOB binary large object form using memory stream. To do this,
Photo1.Image.Save(mstream,System.Drawing.Imaging.ImageFormat.Jpeg)
54
To delete and edit data in the database on the other hand, query using DELETE
FROM and UPDATE were used. Code shown in Figure 3.14 and Figure 3.15 shows
the use of new command to execute query to delete and update data from the MySQL
database. The difference between delete and edit is just the query.
'Update database
Dim query As String
query = "UPDATE cspmatrix.defects Set Name = '" & txtBuildingName.Text & "',
Address = '" & txtAddress.Text & "', Owner = '" & txtOwner.Text & "',
Date = '" & InspectionDate.Text & "', Weather = '" & txtWeather.Text &
"' Where No = '" & BuildingID.Text & "'"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
55
3.3.3 Program Testing
One of the most important phases within software development life cycle (SDLC) is
testing phase. Testing is the process of evaluating a system or its component with
the intent to find whether it satisfies the specified requirements or not. The extent of
software testing consists of implementation of that code in different domain and also
to look at the features of the code to identify does the software do what it is should
be done and methods respect to the condition. Testing usually conducted after
implementation and coding is complete. By doing so, developer will be able to detect
errors and bugs exist in the program decrease the reworking of getting errors in the
in return indicate the extent to which the component or system under test will:
When it comes to testing the software, there are three ways or type of test
can be follow during testing phase of SDLC. The first test is regression test. A
software product. Test cases are re-executed in order to check whether previous
functionality of application is working fine and new changes have not introduced any
56
new bugs. This test can be performed on a new build when there is significant
change in original functionality or even a single bug fix. Though regression testing
can be performed manually an automated test suite is often used to reduce the time
to determine the load under which it fails and how. In other word, stress testing
failure. For example, a web application with data might be flooded, connections, and
so on until it finally crashes. Often Stress Testing is performed using a very high level
of simulated load.
The third software testing on the other hand is load testing. While stress
testing tries to break the system under test by overwhelming its resources or by
taking resources away from it (in which case it is sometimes called negative testing).
Load testing implies a controlled environment moving from low loads to high. Stress
testing focuses on more random events, chaos and unpredictability. Using a web
i) Randomly shut down and restart ports on the network switches/routers that
iii) Run a process that consumes resources (CPU, memory, disk, network) on
57
For this project, software testing will be conducted in the same laptop
computer the where the CSP Program is developed. The laptop computer used for
3.3.4 Deployment
ready for market. In deployment phase, there are several activities can be found.
These activities can occur to both developer and end user. The precise process or
unique. Thus, deployment phase should be treated as a baseline that every program
the activity where users make the software available in their computer and making it
ready to be executed. Because each program is unique, most programs come with an
installer. Installer is a specialized program that helps user in the installation process.
When executing the installer provided, user will be guided through the installation
process.
58
3.4 Analysis
Based on data acquired form conduction of site inspection, data will be used as an
input into the CSP Program developed. First, category of defect building element is
selected and labeled. Next, the condition and assessment of the building element
acquired from site inspection will be inserted into the correct text field before it is
added into the system. In addition, photo of defected building element will be
uploaded into the program. After all defects of a building have been added, it is then
computed by clicking compute button within the program. By doing so, the final
After obtaining overall score of all lecture halls, comparison can me made
based on the lecture halls condition and age. Conclusion will then be made based on
59
CHAPTER 4
4.1 Introduction
Results obtained from building inspection and software development will be shown
and discussed in this chapter. The result section is comprised of two parts. In the
first part, result from developing the CSP Program and the second part is the result
After testing, The CSP Program, it is ready for deployment and installation. The
minimum and recommended requirements for running the program are as follows:
60
HD Space: 100 MB available space
The developed program will greet user with custom splash screen when it is
opened. When it finish loading, the program will bring user to its main form (Main
Window). Figure 4.1 and 4.2 shows the custom splash screen and main window. The
main window layout is designed in such way that it eases User to add, update or
61
Figure 4.2: Main Window (Form 1).
The program enable user to open and display list of defects for the selected
building. This is done by selecting building and clicking Open button. Several
Description, Score and even Image is shown in the defect list (Figure 4.2). There are
several function embedded in this window. It allows user to add, edit or view a
defect. In addition to that, user also will be print the result by navigating to the menu
strip, Print > Print Result. The full table view in this window was designed to ensure
the program to display contents in one window without missing any information.
62
Figure 4.3: Form 2 (Defect List Window).
If preferred, the program also grants user the ability to view detail of a
particular defect from the defect list. This is done by clicking the View button in
the Defect list form. This in return opens a new window (Figure 4.3 showing all the
information of the specific defect chosen. Details displayed are; category, element,
sub-element, condition, assessment, description, score of the defect and two images.
This information is passive and cannot be altered for the viewing purpose.
63
Figure 4.4: Form 3 (Detail View Window).
As mentioned, the program allows user to print the result from the defect list
Document (Figure 4.4) is achieved by navigating to the menu strip, Print > Print
Result, giving more flexibility to the user. The method of opening new Word
Document is preferred instead of opening a print preview window that can only print
hard coded text in a receipt form. Opening mew Word Documents gives user
flexibility to edit, print save and even saving the document in a different format for
future use.
64
Figure 4.5: Microsoft Office Document.
Clicking Add New button from the second window will open a new window
called New Defect Form (Figure 4.5). Allowing user to add new defect by filling all
the information required. This information will then be saved into MySQL database by
65
The program also gives flexibility to the user to edit individual defect clicking
Edit button from the Defect List window. When clicked, a new window called Edit
Defect Form (Figure 4.6) appears. This form is similar to the New Defect Form. By
clicking the Update button; new information from all the comboboxes and
Lastly, there is also a small future embedded in the program that allows user
is given power to add a new element and sub-element into database when an
performed by navigating to tool strip menu, File > Add New Element in either Add
Defect or Edit Defect window. In this window (Figure 4.7), user can add, delete and
edit both element and sub-element that are in the database. This feature give the
66
Figure 4.8: Form 6 (Element Window).
Dewan Kuliah Pusat 1 (DKP1) and Dewan Kuliah Awam (DKA) are the three
buildings used to test the reliability of the CSP Program. Building inspection was
carried out on 5 April 2017 in sunny weather conditions, 12 April 2017 in sunny
weather conditions for DKP1, DKA respectively. The inspection was carried out during
a two and a half hour period, and visual inspection was the primary survey method.
The inspection started with the buildings exterior and concluded with the buildings
interior. A top-down and clockwise surveying technique was adopted for this building
inspection. This procedure is one of the surveying techniques suggested by Hollis and
Gibson (2000) and Hoxley (2002) and is designed to prevent surveyors from
overlooking any defects. At the time of inspection, there were no users inside the
building.
67
After conducting a building inspection for both DKP1 and DKA, all the data of
defects was then keyed in into the program. The method of describing each defect as
well as tagging and sorting the all the defects was adopted based on (Che-Ani et al.
(2011). Each defect saved into the program is accompanied by 2 images as shown in
Figure 4.3. All the defects were arranged according to their category and grouped
together by their element and location as repair work for these defects is likely to be
Result from the building inspection of DKP1 of UMS was obtained and shown
in Table 4.1 below. The total score was obtained by dividing the total marks from all
the defects with the number of defects. The table shows defect found at DKP1 and
sort them by category (exterior, interior & services). After clicking Print Result on the
defect list window of the CSP Program, an executive summary (Appendix A) showing
the summed score, number of defects and the total score. In addition, this summary
also highlights the property information, the summary of CSP1 matrix, the Overall
Building Rating and the recommendation. A total of defects of 20 were found with
total marks of 136. Majority 11 of defects found were in Good Condition (Green
Color). Meanwhile, 7 of defects found were in Fair Condition (Yellow Color) and 2
68
Table 4.1: Schedule of building Condition for DKP 1, UMS.
Defects
Condition Assessment Score Defect tag
Category Element Sub-Element No.
Wall Paint
1 2 1 2 E1
Chipping paint.
Wall Plastering
2 2 2 4 E2
Architectural crack on wall.
Door Hinge
3 3 3 9 E3
Door hinge fail. Door knob fail.
Wall Plastering
4 2 2 4 E4
Architectural crack on wall.
Wall Paint
5 1 1 1 E5
Mold on wall.
Wall Paint
6 1 1 1 E6
Mold on wall.
Lightning Copper
Conductor Conductor 7 4 3 12 E7
Missing lightning conductor.
Light -
Exterior 8 5 3 15 E8
Missing light
Roof Cover
11 2 2 4 E11
Vegetation growing on roof.
Speaker -
13 5 3 15 E13
Missing speaker unit.
Door Panel
15 2 2 12 E15
Broken Panel on hinge side.
Lights Starter
20 4 3 12 S3
Light not turning on. Starter failure
69
E5
S1
E4
E7
I1
E3
E6
E2
I2
E8
S2
E1
E9
E15
E14
S3
E13
E10
E12
E11
2 Interior 2 10
3 Services 3 15
Total 20 100
Table 4.2 shows the number of defect exists by its category for DKP 1, UMS.
Referring to the table, it is clear that number of defect of exterior found to have the
highest percentage of defect at 75% from the total defect. This high percentage is
may be due to the exposure of the exterior element of the building to the outside
environment, for example; weather, animals and vegetation. Vegetation was found at
rear and front of lecture hall causing defect to exterior of the lecture hall. Growing
trees such as ficus on bricks or timber can cause failure to the structure. Ficus roots
penetrate deep into the structure through the capillaries or gaps between brick works
(Wei et al., 2011). Based on Figure 4.8, exterior defect can be seen along the
exterior of the lecture hall. Interior and Services defect on the other hand, have
percentage of 10% and 15% respectively. Defects for interior and service are less
compared to exterior defect. The defect that exists in these two categories can be
described as normal wear defect. For example, displaced ceiling panel and faulty light
bulb can be found inside the lecture hall. These defects can be caused due to wear
and tear of the item when it is used and are usually directly proportional to time.
71
Table 4.3: Number of defects according to building element for DKP 1,
UMS.
1 Wall 6 30
2 Roof 2 10
3 Lighting 3 15
4 Ceiling 1 5
Opening (Door or
5 4 20
Window)
6 Drain 1 5
7 Others 3 15
Total 20 100
Table 4.3 shows the number of defect in relation to the element of defect.
Based on the table, it clearly shows that for DKP 1 wall has the highest percentage of
defect of 30%. Wall defects found at DKP1 vary from finishing paint to plastering
crack. Finishing paint for wall was found to be peeling from the wall. Peeling usually
occurs on building facades, mainly on plastered walls, columns and other areas which
are exposed to excessive rain and great dampness (Nadia et al., 20014). Plaster
crack seen on the lecture hall on the other hand, are caused improper curing process
during construction. Surface cracks are commonly found on the concrete flat roof and
floor screed and normally caused by improper curing process (Mohd Sarman et al.,
2015). The second highest of defect is door and window with value of 20%. Most of
door and window defect on DKP1 are door hinge door knob defect. Some of the door
knobs were found to be unusable while some are missing. Lighting defect and other
defect which consist of; lightning conductor, seats and speaker unit is at the third
highest with percentage of 15%. Some lights were found not functioning properly
72
due to faulty component for example; light bulb, starter, stolen lightning conductor
and even missing speaker unit. Meanwhile, roof defect contribute to 10 % of total
lecture hall defect while both ceiling and drain contribute to 5% of total building
were found in roof of DKP1. Some part of the roof was observed to have mold and
vegetation growing while other part of the roof found to have chipped roof tiles. This
occurs when water vapor condenses on the surface allowing mold to grow (Wei et
al., 2011). Moldy surface frequently happen in areas with a high water content or
surface contact with moisture in long period (Mohd Sarman et al., 2015). For ceiling,
only minor defect was found as the ceiling panel displaced from its original position
with no sign of leakage. Similarly, minor defect was found for drain as the drains
Result from the building inspection of DKA, PKK on the other hand, was
obtained and shown in Table 4.3 below. In this table, defects are categorized
according to their category. The table also highlights the description of defect found,
condition, assessment, and the score of the defect. Defect is color-coded based on
the defect score computed. Data from the building inspection was keyed in into the
summed score, number of defects and the total score. From table 4.4, it can be seen
that the majority 10 of defects found were in Good Condition (Green Color).
Meanwhile, 7 of defects were found in Fair Condition (Yellow Color) and zero defects
in Dilapidated Condition.
73
Table 4.4: Schedule of building Condition for DKA, PKK.
Defects
Condition Assessment Score Defect tag
Category Element Sub-Element No.
Roof Insulator
Part of the insulator is exposed and 1 1 2 2 E1
hanging from the roof ceiling.
Door Panel
Crack on door panel due to 2 3 3 9 E2
exposure to rainwater.
Railing Hand Rail
Chipped and scratched paint. 3 1 1 1 E3
Causing it to rust.
Wall Plastering
4 2 2 4 E4
Hair line crack on window opening.
Exterior
Roof Insulator
5 1 1 1 E5
Insulator cover is ripped off.
Downpipe Fitting
The pipeline is not aligned. Leaving 6 1 1 1 E6
small opening
Downpipe Bracing
7 1 1 1 E7
Rust on Bracing of the pipe
Wall Plastering
The Plastering near door frame is 8 2 2 4 E8
cracking and chipped off.
Floor Floor Surface
The floor finishing is chipped. 9 3 3 9 I1
Leaving holes that expose inner
material.
Sound
Absorbing Finishing
Wall 10 2 2 4 I2
The fabric finishing of the insulator
Interior is torn.
Sound
Absorbing Finishing
Wall 11 2 2 4 I3
The fabric finishing of the insulator
is torn.
Stairs Finishing
The finishing of the edge of the 12 2 2 4 I4
stair is deteriorating.
Lights Starter
13 3 3 9 S1
Light fain to turn on.
74
S3
E7 S4
E6
S2
E5
I4
S1
E4
I3
DKA
I2 I1
E3
E8 E1
E1
75
Table 4.5: Number of defects according to category for DKA, PKK.
No. of Percentage
No. Category
Defect (%)
1 Exterior 8 47
2 Interior 4 26.67
3 Services 5 33.33
Total 17 100
From Table 4.5, it clearly shows that the highest percentage of defect for
DKA, PKK is exterior with the value of 47%. Interior defects on the other hand,
contribute to 26.67% of the total defect of the building while services contribute
than service defect with a difference of 13.67 %. The high exterior defect percentage
is due to the exposure of the exterior building element to the weather. During
inspection, it was observed that roof spanning outward from the lecture hall was
short, exposing other building element to the weather change. Most of the interior
defects of the lecture hall are finishing defect. These defects are cause by normal
wear and tear of everyday use. Services defect is the second highest percentage for
this lecture hall. Services defect is cause by wear and tear of everyday use an
76
Table 4.6: Number of defects according to building element for DKA, PKK.
1 Wall 4 23.53
2 Roof 2 11.76
Opening (Door or
3 1 5.88
Window)
4 Railing 1 5.88
5 Floor 2 11.76
6 Lighting 2 11.76
7 Drain 2 11.76
8 Others 3 17.64
Total 17 100
Table 4.6 shows number of defects with respect to the building element for
DKA, PKK. Referring to the table, 23.53% of the defects are wall defect. Roof, floor,
lighting and drain on the other hand contribute to 11.76% from the overall lecture
hall each. While both opening (door & window) and railing contributes 5.88% of the
overall buildings defect. Lastly, 17.64% from the total defect are contributed by
other defect which includes; Visual display, audio and main switch box.
cracks, joint cracks and others. (Mohd Sarman et al., 2015). All of the wall defects on
DKA are finishes defect. A small hairline crack was found on exterior part of the
lecture hall while few sound insulating finishes of interior of lecture hall were found
to be torn or degrade. For roof defect on the other hand, only minor defect of roof
insulator was observed. The cover of the roof insulator was found to be torn on the
exterior part of the lecture hall. Other than that, no leakage was found. The main
77
entrance door for DKP1 on the other hand, it was found that decay occur on the door
panel. These defects are mainly caused by the timber in service being subjected to
environmental exposure (Nadia et al., 20014). This is because the main door of the
lecture hall is located near side of the building coupled with the short spanning of
roof leaves the door exposing the main door to rainwater. Railing was found to be
corroded due to chipped pain and exposure to rain water. Besides that, there were
defect found on the floor of the lecture hall. Puncture marks were found at the door
of the lecture hall. These puncture hall is caused by the inner gate lock that comes in
contact with the floor finishing. Some of lights found in the lecture hall found to be
not functioning due to components failure such as broken light bulb, broken light
displaced from its bracing. Display screen/curtain was found to be not functional and
fail to roll upward while audio box and switch box were exposed and left unattained.
This shows that these equipment or services are not handled properly after used.
Overall
Total No. Of
Building Total Score Building
Marks Defect
Rating
Table 4.7 summarizes the executive summary of both lecture halls. From the
executive summary, it can be seen that total marks for DKP1 and DKA are 136 and
89 respectively. This shows that DKP1 has slightly serious defect compared to DKA.
78
Looking back at table 4.1 and 4.4, DKP1 has two defects that require serious
attention while DKA have none. This explains the severity of defect on both lecture
halls. When taking into account the number of defects between these two lecture
halls, the total marks of DKP1 is still slightly higher than DKA. With total marks of 17,
DKP1 has higher total score compared to DKA. However, both lecture halls obtain the
performance. Facility for both lecture hall inspected were working in a fair condition.
Uline C.L., 2010 showed that physical conditions of the school played a role in
79
CHAPTER 5
5.1. Introduction
This chapter will conclude all the findings throughout the study based on the
objectives and some recommendation will make for the future study. All the three
objectives for this study had achieved. The first objective is to develop Windows
Application that can compute score of building based on CSP1 Matrix while the
second objective is to assess condition of lecture hall using CSP1 Matrix. The third
and last objective is to obtain and compare overall building rating for several lecture
5.2. Conclusion
properly. The program was able to compute defect score and produce rating for the
inspected building. In addition to that, the program also able to save, deletes, and
sort data accordingly making it easier for surveyor to come up with the final result.
Executive summary can be produced, edited and saved by user for future reference.
The User interface of the program was found to be easy and user friendly. A small
feature has been added in the program to allow user to add, edit or even delete
building element. This ensures flexibility of inputting new element that might exist or
80
Condition of lecture halls were successfully assessed using CSP1 Matrix in
this study. CSP1 Matrix utilizes numerical value and use color coding based on defect
score, this help surveyor to compute building rating efficiently. Additionally, using
CSP1 Matrix help reduce building inspection time as there is no need for surveyor to
Building condition is important for owner of the particular building to evaluate their
current asset. With using CSP1 Matrix, building owner will be able to see all defects
that exist in a building and help them to highlight which part of the building or which
5.3. Limitation
Throughout the conduction of this study, there are several limitations that
exist. The first limitation is limited access to lecture hall as there are lack of
5.3. Recommendation
81
REFERENCES
Baunmann E. & Averett T. 2008.Lecture Hall Acoustics at the College of William &
Mary.
Benedict, M.E., and J. Hoag. 2004. Seating location in large lectures: Are seating
preferences or location related to course performance? Journal of Economic
Education35 (3), 21531.
Friedman J. P., Harris J. C., & Diskin B. A. 2009. Barrons Real Estate Handbook. New
York: Hauppauge.
Che-Ani, A. I., Ali, A. S., Tahir, M. M., Abdullah, N., Ho, G. T., &Tawil, N. M.
2010.The development of a Condition Survey Protocol (CSP) 1 Matrix for visual
building inspection. In Construction, Building and Real Estate Research
Conference of the Royal Institution of Chartered Surveyors, COBRA 2010.
82
Che-Ani, A. I., Tawil, N. M., Johar, S.,Razak, M. Z. A., &Yahaya, H. 2014. Building
Condition Assessment for New Houses: A Case Study in Terrace Houses. Jurnal
Teknologi, 70(1).
Che-Ani, A. I., Samsul Mohd Tazilan, A., & Afizi Kosman, K. 2011.The development of
a condition survey protocol matrix.Structural Survey, 29(1), 35-45.
Chew, M. Y. L., & De Silva, N. 2003. Maintainability problems of wet areas in high-
rise residential buildings. Building Research and Information, 31(1), 60-69.
Deitel H. M., Deitel P. J., Neito T. R. 2002. Visual Basic .NET How to Program Second
Edition.New Jersey; Upper Saddle River.
Dr. Liew, V. K. 2013. Visual Basic 2013 Made Easy. In Liew Voon Kiong.
Elhakeem, A. A., &Hegazy, T. 2005. Towards a visual guidance system for condition
assessment of the building infrastructure.In Proceedings of 1st CSCE Specialty
Conference on Infrastructure Technologies, Management, and Policies, CSCE,
Toronto, Ontario, Canada, June (pp. 2-4).
Elkhateeb, A. A. 2012. The acoustical design of the new lecture auditorium, Faculty
of Law, Ain Shams University. Ain Shams Engineering Journal, 3(3), 219-235.
Greimann, L., Stecker, J., Kraal, T., & Foltz, S. (1997). Condition Rating Procedures
for Roller Dam Gates.Technical Report REMR-OM-18, US Army Construction
Engineering Research Laboratory, Champaign, IL.
83
Halterman, R. L. 2016. Fundamentals of C++ Programming. Tennessee: Southern
Adventist University.
Hamzah, N., Mahli, M., Che-Ani, A. I., Tahir, M. M., Abdullah, N. A. G., &Tawil, N. M.
2010. The Development of Smart School Condition Assessment Based on
Condition Survey Protocol (CSP) 1 Matrix: A Literature Review. World Academy
of Science, Engineering and Technology, International Journal of Civil,
Environmental, Structural, Construction and Architectural Engineering, 4(11),
369-374.
Holliman, W.B., and H.N. Anderson. 1986. Proximity and student density as
ecological variables in a college classroom. Teaching of Psychology 13 (4),
20003.
Jago, E., & Tanner, K. (1999). Influence of the school facility on student
achievement. Dept. of Educational Leadership; University of Georgia.
84
Louden, K. C. 2003. Programming Languages: Principles and Practice Computer
Science Series. University of California
Lounis, Z., Vanier, D. J., Lacasse, M. A., & Kyle, B. 1998.Effective decision-making
tools for roofing maintenance management.In First International Conference on
New Information Technologies in Civil Engineering (pp. 425-436).
Mackanzie, D. & Sharkey, K. 2002.Visual Basic .NET in 21 Days. New Delhi: Darya
Ganji.
Mali, M., Che-Ani, A. I., Abd-Razak, M. Z., Twail, N. M., Yahya, H.2012. School Age
and Building Defects: Analysis Using Condition Survey Protocol (CSP) 1 Matrix.
World Academy of Science, Engineering and Technology, International Journal
of Social, Behavioral, Educational, Economic, Business and Industrial
Engineering 6(7).
McQuiston, F. C., Parker, J. D., Spitler, JD. 2005, Heating, Ventilating and Air
Conditioning: Analysis and Design, Sixth Edition.New York, John Wiley & Sons,
Inc.
Nadia, N., Bakri, O., Azree, M., & Mydin, O. 2014. General Building Defects: Causes,
Symptoms and Remedial Work. European Journal of Technology and Design,
(1), 417.
OSH. 2007. Thermal Comfort for Office Work, Canadian Centre for Occupational
Health and Safety.
Pedersen, D.M. 1994. Personality and classroom seating.Perceptual and Motor Skills
78 (33), 135560.
85
Perkins, K.K., and C. Wieman. 2005. The surprising impact of seat location on
student performance. The Physics Teacher43(1),3033.
RICS.2009. RICS Homebuyers Service 2009 3rd Edition Practice Notes. Residential
Property Group of the Royal Institution of Chartered Surveyors (RICS). United
Kingdom: Coventry.
Salvage, J. 2003. The Visual Basic .NET Coach. Pennsylvania; Drexel University
Samah, A. H., Tawil, N. M., Mahli, M., Che-Am, A. I., &Abd-Razak, M. Z. 2014.
Building condition assessment using condition survey protocol matrix. Research
Journal of Applied Sciences, 9(9), 565-572.
Sarman, Mohd, A., Che-ani, & Irfan, A. 2015. Concrete Flat Roof Defects in Equatorial
Climates. International Journal of Applied Engineering Research. 10(3), 36.
Torres, D. E., & Anders, J. L. 1995. Using MS visual basic to write engineering
applications.In Petroleum Computer Conference.Society of Petroleum
Engineers.
Uline, C. L., Wolsey, T. D., Tschannen-Moran, M., & Lin, C. D. 2010. Improving the
physical and social environment of school: A question of equity. Journal of
school leadership, 20(5), 597-632.
86
Ulukavak Harputlugil, G., &Hensen, J. L. M. 2006.The relation between building
assessment systems and building performance simulation.In Proceedings of the
6th Int. Postgraduate Research Conf. in the Built and Human Environment, 6 -
7 April, TechnischeUniversiteit Delft, BuHu, University of Salford. (pp. 333-343).
Uzarski, D. R., & Burley, L. A. 1997. Assessing building condition by the use of
condition indexes. Infrastructure Condition Assessment: Art, Science, Practice,
ASCE, Reston, Va., 365374.
Wahida, R. N., Milton, G., Hamadan, N., Lah, N. M. I. B. N., & Mohammed, A. H.
2012.Building Condition Assessment Imperative and Process. Procedia-Social
and Behavioral Sciences, 65, 775-780.
Yau, Y. H., Chew, B. T., Saifullah, A. 2011. Thermal Comfort in Lecture Halls in the
Tropics.Department of Mechanical Engineering, University of Malaya, Kuala
Lumpur.
Wei, Y. T., Hapas, M. H. B. M., Binti, Nur Aini Adibah Hassan, N. B. J., & Huat, T. S.
2011. The Effects of Vegetation And Water Elements On A Building CASE
STUDY : ROYAL SELANGOR CLUB OF KUALALUMPUR, MALAYSIA.
87
Youssef, R. S., Bard D., Mahmoud, A. E. F., & Esa, N. M. 2014. Acoustical Quality
Assessment of Lecture halls at Lund University, Sweden.National Institute for
Standards (NIS), Cairo-Egypt.
88
APPENDICES
89
Appendix B: Executive Summary for Dewan Kuliah Awam (DKA), PKK
90
Appendix C: Source code of every window
Main Window
Imports MySql.Data.MySqlClient
Try
MysqlConn.Open()
Dim query As String
query = "TRUNCATE TABLE building_list"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Alter Table funcition
Private Sub AlterTable()
New_Connection()
Try
MysqlConn.Open()
Dim query As String
query = "ALTER TABLE building_list AUTO_INCREMENT = 1 "
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Load Table
91
Private Sub loadTable()
New_Connection()
Try
DataGridView1.RowTemplate.Height = 30
AlterTable()
MysqlConn.Open()
Dim query As String
query = "SELECT * FROM cspmatrix.building_list"
command = New MySqlCommand(query, MysqlConn)
sda.SelectCommand = command
sda.Fill(dbdatatableas)
dbsource.DataSource = dbdatatableas
DataGridView1.DataSource = dbsource
sda.Update(dbdatatableas)
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Show up on all fields when datagrid selected
Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs)
Handles DataGridView1.CellClick
Try
Dim insdate As Date
BuildingID.Text = DataGridView1.Item(0, DataGridView1.CurrentRow.Index).Value
txtBuildingName.Text = DataGridView1.Item(1, DataGridView1.CurrentRow.Index).Value
txtAddress.Text = DataGridView1.Item(2, DataGridView1.CurrentRow.Index).Value
txtOwner.Text = DataGridView1.Item(3, DataGridView1.CurrentRow.Index).Value
insdate = DataGridView1.Item(4, DataGridView1.CurrentRow.Index).Value
InspectionDate.Text = Format(insdate, "yyyy/MM/dd")
txtWeather.Text = DataGridView1.Item(5, DataGridView1.CurrentRow.Index).Value
Catch ex As Exception
End Try
End Sub
'main page load
Private Sub mainView_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Call loadTable()
New_Connection()
End Try
92
End Sub
'Open building
Private Sub Open_Click(sender As Object, e As EventArgs) Handles Open.Click
Dim itemView As DefectsList
Dim selectedRowCount As Integer =
DataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected)
Dim id As Integer
Dim name As String
If selectedRowCount = 0 Then
Dim i As Integer
For i = 0 To selectedRowCount - 1
id = DataGridView1.SelectedRows(i).Cells("No").Value
name = DataGridView1.SelectedRows(i).Cells("Name").Value
Next i
End If
End Sub
'Delete Building
Private Sub Delete_Click(sender As Object, e As EventArgs) Handles Delete.Click
Call New_Connection()
Try
AlterTable()
MysqlConn.Open()
Dim i As Integer
For i = 0 To selectedRowCount - 1
id = DataGridView1.SelectedRows(i).Cells("No").Value
Next i
End If
MysqlConn.Open()
Dim query As String
query = "DELETE FROM cspmatrix.building_list
WHERE No = " & id & ""
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
93
Name = txtBuildingName.Text
Dim message As String
message = "" & Name & " Deleted"
MessageBox.Show(message)
MysqlConn.Close()
txtBuildingName.Clear()
txtAddress.Clear()
txtOwner.Clear()
InspectionDate.Clear()
txtWeather.Clear()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
loadTable()
End Sub
'Time picker change format
Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles
DateTimePicker1.ValueChanged
InspectionDate.Text = Format(DateTimePicker1.Value, "yyy/MM/dd")
End Sub
'Add New Building
Private Sub AddNew(sender As Object, e As EventArgs) Handles Add.Click
Call New_Connection()
Try
AlterTable()
MysqlConn.Open()
Dim query As String
query = "INSERT INTO cspmatrix.building_list
(Name, Address, Owner, Date, Weather)
VALUES ('" & txtBuildingName.Text & "', '" & txtAddress.Text & "', '" &
txtOwner.Text & "', '" & InspectionDate.Text & "', '" & txtWeather.Text & "')"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
Name = txtBuildingName.Text
Dim message As String
message = "" & Name & " Added"
MessageBox.Show(message)
txtBuildingName.Clear()
txtAddress.Clear()
txtOwner.Clear()
InspectionDate.Clear()
txtWeather.Clear()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
loadTable()
End Sub
'Update Building
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Call New_Connection()
Try
AlterTable()
MysqlConn.Open()
94
Dim query As String
query = "UPDATE cspmatrix.building_list
Set Name = '" & txtBuildingName.Text & "',
Address = '" & txtAddress.Text & "',
Owner = '" & txtOwner.Text & "',
Date = '" & InspectionDate.Text & "',
Weather = '" & txtWeather.Text & "' Where No = '" & BuildingID.Text &
"'"
Name = txtBuildingName.Text
Dim message As String
message = "" & Name & " is Updated"
MessageBox.Show(message)
txtBuildingName.Clear()
txtAddress.Clear()
txtOwner.Clear()
InspectionDate.Clear()
txtWeather.Clear()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
loadTable()
End Sub
'Clear Button
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
BuildingID.Clear()
txtBuildingName.Clear()
txtAddress.Clear()
txtOwner.Clear()
InspectionDate.Clear()
txtWeather.Clear()
End Sub
'Exit app via tool strip menu
Private Sub ExitToolStripMenuItem_Click_1(sender As Object, e As EventArgs) Handles
ExitToolStripMenuItem.Click
Application.Exit()
End Sub
'Exit application when application closed
Private Sub MainPage_Close(sender As Object, e As EventArgs) Handles MyBase.FormClosed
Application.Exit()
End Sub
'Show tutorial
Private Sub TutorialToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
TutorialToolStripMenuItem.Click
Help.Show()
End Sub
'Show About
Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
AboutToolStripMenuItem.Click
About.Show()
End Sub
End Class
95
Defect List
Imports MySql.Data.MySqlClient
Try
MysqlConn.Open()
Dim query As String
query = "TRUNCATE TABLE defects"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Alter Table funcition
Private Sub AlterTable()
New_Connection()
Try
MysqlConn.Open()
Dim query As String
query = "ALTER TABLE defects AUTO_INCREMENT = 1 "
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Load table funcition
Private Sub loadTable()
New_Connection()
DataGridView1.RowTemplate.Height = 70
AlterTable()
MysqlConn.Open()
green = 0
yellow = 0
red = 0
total = 0
totalMark = 0
sda.Update(dbdatatableas)
DataGridView1.Refresh()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
'DataGridView1.Columns("Image").Width = 100
InitializeComponent()
97
' Add any initialization after the InitializeComponent() call.
BuildingName = name1
id = id1
End Sub
'Load Form
Private Sub itemView_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Text = BuildingName
loadTable()
End Sub
'Active funcition
Public Sub itemView_Active(sender As Object, e As EventArgs) Handles MyBase.GotFocus
loadTable()
End Sub
'Exit application when it is closed
Private Sub itemView_Close(sender As Object, e As EventArgs) Handles MyBase.FormClosed
Application.Exit()
End Sub
' Help > tutorial
Private Sub TutorialToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
TutorialToolStripMenuItem.Click
Help.Show()
End Sub
'Help > About
Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
AboutToolStripMenuItem.Click
About.Show()
End Sub
'Ecxit application via tool strip
Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
ExitToolStripMenuItem.Click
Application.Exit()
End Sub
'Back Button
Private Sub BackToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
BackToolStripMenuItem.Click
Dim mainView As mainView
mainView = New mainView()
Me.Hide()
mainView.Show()
End Sub
'Delete Defect
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Call New_Connection()
Try
AlterTable()
MysqlConn.Open()
Dim query As String
Dim selectedRowCount As Integer =
DataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected)
Dim id As Integer
If selectedRowCount > 0 Then
Dim i As Integer
For i = 0 To selectedRowCount - 1
id = DataGridView1.SelectedRows(i).Cells("No").Value
Next i
End If
98
reader = command.ExecuteReader
MessageBox.Show("Defect Deleted")
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
loadTable()
End Sub
'Open add new defect
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim add As NewDefect
add = New NewDefect(BuildingName, id)
add.Show()
Dim Form12 = Me
Form12.Hide()
End Sub
'Open edit defect
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Dim itemView As EditDefect
Dim selectedRowCount As Integer =
DataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected)
Dim ide As Integer
If selectedRowCount > 0 Then
Dim i As Integer
For i = 0 To selectedRowCount - 1
ide = DataGridView1.SelectedRows(i).Cells("No").Value
Next i
End If
If selectedRowCount = 0 Then
Dim i As Integer
For i = 0 To selectedRowCount - 1
category = DataGridView1.SelectedRows(i).Cells("Category").Value
element = DataGridView1.SelectedRows(i).Cells("Elements").Value
subelement = DataGridView1.SelectedRows(i).Cells("Sub-Element").Value
condition = DataGridView1.SelectedRows(i).Cells("Condition").Value
assessment = DataGridView1.SelectedRows(i).Cells("Assessment").Value
Next i
End If
End Sub
'View Defect Details
Private Sub More_Click(sender As Object, e As EventArgs) Handles More.Click
Dim itemView As Defect_Details
Dim selectedRowCount As Integer =
DataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected)
Dim ide As Integer
If selectedRowCount > 0 Then
99
Dim i As Integer
For i = 0 To selectedRowCount - 1
ide = DataGridView1.SelectedRows(i).Cells("No").Value
Next i
End If
If selectedRowCount = 0 Then
Dim i As Integer
For i = 0 To selectedRowCount - 1
category = DataGridView1.SelectedRows(i).Cells("Category").Value
element = DataGridView1.SelectedRows(i).Cells("Elements").Value
subelement = DataGridView1.SelectedRows(i).Cells("Sub-Element").Value
condition = DataGridView1.SelectedRows(i).Cells("Condition").Value
assessment = DataGridView1.SelectedRows(i).Cells("Assessment").Value
Next i
End If
End Sub
'Open Result
Private Sub PrintResultToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
PrintResultToolStripMenuItem.Click
MessageBox.Show("Result will be shown in a Word Doc file. Feel free to save and
print.")
Dim result As PrintPreview
totalScore = totalMark / total
If (totalScore > 12) Then
comment = "Dilapidated"
ElseIf (totalScore > 4) Then
comment = "Fair"
ElseIf (totalScore > 0) Then
comment = "Good"
End If
result = New PrintPreview(BuildingName, id, green, yellow, red, total, totalScore,
totalMark, comment)
result.Show()
End Sub
End Class
New Defect
Imports MySql.Data.MySqlClient
Imports System.IO
100
Public Sub New(ByVal Name1 As String, ByVal ID1 As Integer)
InitializeComponent()
BuildingName = Name1
id = ID1
End Sub
'New MySql Connection
Private Sub New_Connection()
MysqlConn = New MySqlConnection
MysqlConn.ConnectionString = "server=localhost;" _
& "uid=root;" _
& "pwd=password123;" _
& "database=cspmatrix;"
End Sub
'Alter Table funcition
Private Sub AlterTable()
New_Connection()
Try
MysqlConn.Open()
Dim query As String
query = "ALTER TABLE building_list AUTO_INCREMENT = 1 "
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Cancel
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
Button2.Click
Me.Close()
Dim list As DefectsList
list = New DefectsList(BuildingName, id)
list.Show()
End Sub
Private Sub populate_category()
Call New_Connection()
Try
101
MysqlConn.Open()
Dim query As String
query = "SELECT * FROM cspmatrix.category"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
CategoryCombo.Items.Clear()
While reader.Read
Dim sName = reader.GetString("Category")
CategoryCombo.Items.Add(sName)
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Load Window
Private Sub NewDefect_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
Me.Text = "New Defect"
Call populate_category()
End Sub
'Show Elemets if Certain Category is selected
Private Sub CategoryCombo_SelectedIndexChanged(sender As Object, e As
EventArgs) Handles CategoryCombo.SelectedIndexChanged
Call New_Connection()
Try
MysqlConn.Open()
Dim query As String
query = "SELECT * FROM cspmatrix.elements WHERE Category ='" &
CategoryCombo.Text & "'"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
ElementCombo.Items.Clear()
subelementCombo.Items.Clear()
While reader.Read
Dim sName = reader.GetString("Element")
ElementCombo.Items.Add(sName)
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
102
Call New_Connection()
Try
MysqlConn.Open()
While reader.Read
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
End Sub
'Connect to Database
Call New_Connection()
Try
AlterTable()
MysqlConn.Open()
'Score of Element
Dim condition As Integer
Dim assessment As Integer
Dim score As Integer
'Insert Image
Dim mstream As New System.IO.MemoryStream
Photo1.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg)
Dim arrImage() As Byte = mstream.GetBuffer()
mstream.Close()
'Insert Image2
Dim mstream2 As New System.IO.MemoryStream
104
Photo2.Image.Save(mstream2,
System.Drawing.Imaging.ImageFormat.Jpeg)
Dim arrImage2() As Byte = mstream2.GetBuffer()
mstream2.Close()
'Start Saving
Dim query As String
query = "INSERT INTO cspmatrix.defects
(Category, Elements, `Sub-Element`, Location , `Condition`,
Assessment, Description, Score, Image, Image2, ID)
VALUES ('" & CategoryCombo.SelectedItem.ToString & "', '" &
ElementCombo.SelectedItem.ToString & "', '" &
subelementCombo.SelectedItem.ToString & "', '" & txtName.Text & "','" &
ConditionCombo.SelectedItem.ToString & "','" &
AssessmentCombo.SelectedItem.ToString & "', '" & txtDescription.Text & "', '" &
score & "', @Image ,@Image2 ,'" & id & "')"
command = New MySqlCommand(query, MysqlConn)
command.Parameters.AddWithValue("@Image", arrImage)
command.Parameters.AddWithValue("@Image2", arrImage2)
reader = command.ExecuteReader
MysqlConn.Close()
Me.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
End Class
Edit Defect
Imports MySql.Data.MySqlClient
Imports System.IO
105
Public Sub New(ByVal ele As String, ByVal subele As String, ByVal cate As String, ByVal
condi As String, ByVal assess As String, ByVal name1 As String, ByVal id1 As Integer, ByVal
realId As Integer)
InitializeComponent()
category = cate
element = ele
subelement = subele
name = name1
condition = condi
assessment = assess
rid = realId
id = id1
End Sub
'Populate Category Combo Box
Private Sub populate_category()
Call New_Connection()
Try
MysqlConn.Open()
Dim query As String
query = "SELECT * FROM cspmatrix.category"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
CategoryCombo.Items.Clear()
While reader.Read
Dim sName = reader.GetString("Category")
CategoryCombo.Items.Add(sName)
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Load Window
Private Sub NewDefect_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Text = "Edit Defect"
Call populate_category()
End Sub
Try
MysqlConn.Open()
Dim query As String
query = "SELECT * FROM cspmatrix.elements WHERE Category ='" & CategoryCombo.Text
& "'"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
ElementCombo.Items.Clear()
While reader.Read
Dim sName = reader.GetString("Element")
ElementCombo.Items.Add(sName)
106
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
Call New_Connection()
Try
MysqlConn.Open()
While reader.Read
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Load EditDefect
Private Sub editView_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Text = "Edit Defect"
CategoryCombo.Text = category
ElementCombo.Text = element
subelementCombo.Text = subelement
ConditionCombo.Text = condition
AssessmentCombo.Text = assessment
New_Connection()
Try
MysqlConn.Open()
Dim query As String
Dim da As New MySqlDataAdapter
Dim dr As MySqlDataReader
Dim ds, ds1 As New DataSet
img2 = ds.Tables(0).Rows(0).Item(3)
Dim ms2 As New MemoryStream(img2)
Photo2.Image = Image.FromStream(ms2)
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Browse Photo
Private Sub Browse1_Click(sender As Object, e As EventArgs) Handles Browse1.Click
Dim OpenFileDialog1 As New OpenFileDialog
OpenFileDialog1.Filter = "Image Files (*)|*.jpg; *.png; *.bmp; *.gif"
If OpenFileDialog1.ShowDialog = System.Windows.Forms.DialogResult.OK Then
path = OpenFileDialog1.FileName
safe = OpenFileDialog1.SafeFileName
Photo1.Image = Image.FromFile(path)
End If
Try
MysqlConn.Open()
'Score of Element
Dim condition As Integer
Dim assessment As Integer
Dim score As Integer
108
ElseIf AssessmentCombo.Text = "Routine" Then
assessment = 2
ElseIf AssessmentCombo.Text = "Urgent" Then
assessment = 3
ElseIf AssessmentCombo.Text = "Emergency" Then
assessment = 4
End If
'Insert Image
Dim mstream As New System.IO.MemoryStream
Photo1.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg)
Dim arrImage() As Byte = mstream.GetBuffer()
mstream.Close()
'Insert Image2
Dim mstream2 As New System.IO.MemoryStream
Photo2.Image.Save(mstream2, System.Drawing.Imaging.ImageFormat.Jpeg)
Dim arrImage2() As Byte = mstream2.GetBuffer()
mstream2.Close()
'Start Saving
Dim query As String
query = "UPDATE cspmatrix.defects
Set Category = '" & CategoryCombo.SelectedItem.ToString & "',
Elements = '" & ElementCombo.SelectedItem.ToString & "',
`Sub-Element` = '" & subelementCombo.SelectedItem.ToString & "',
Location = '" & txtName.Text & "',
`Condition`= '" & ConditionCombo.SelectedItem.ToString & "',
Assessment = '" & AssessmentCombo.SelectedItem.ToString & "',
Description = '" & txtDescription.Text & "',
Score = '" & score & "',
Image= @Image,
Image2= @Image2
Where No ='" & id & "'"
MysqlConn.Close()
Me.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Add new Element Form
Private Sub NewElementToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
NewElementToolStripMenuItem.Click
Dim newelement As EditElement
newelement = New EditElement()
newelement.Show()
End Sub
'Cancel
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Close()
Dim list As DefectsList
list = New DefectsList(name, rid)
list.Show()
End Sub
End Class
109
Defect Details
Imports MySql.Data.MySqlClient
Imports System.IO
Public Sub New(ByVal ele As String, ByVal subele As String, ByVal cate As String, ByVal
condi As String, ByVal assess As String, ByVal name1 As String, ByVal id1 As Integer, ByVal
realId As Integer)
InitializeComponent()
category = cate
element = ele
subelement = subele
name = name1
condition = condi
assessment = assess
rid = realId
id = id1
End Sub
End If
End Sub
Private Sub Defect_Details_Load(sender As Object, e As EventArgs) Handles MyBase.Load
txtCategoty.Text = category
txtElement.Text = element
txtsubelement.Text = subelement
txtCondition.Text = condition
txtAssessment.Text = assessment
New_Connection()
Try
MysqlConn.Open()
110
Dim query As String
Dim da As New MySqlDataAdapter
Dim dr As MySqlDataReader
Dim ds, ds1 As New DataSet
img = ds.Tables(0).Rows(0).Item(3)
Dim ms As New MemoryStream(img)
Photo1.Image = Image.FromStream(ms)
img2 = ds.Tables(0).Rows(0).Item(4)
Dim ms2 As New MemoryStream(img2)
Photo2.Image = Image.FromStream(ms2)
Scorecolor()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
End Sub
End Class
Element/Subelement Edit
Imports MySql.Data.MySqlClient
Imports System.IO
Try
MysqlConn.Open()
Dim query As String
111
query = "SELECT * FROM cspmatrix.category"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
CategoryCombo.Items.Clear()
While reader.Read
Dim sName = reader.GetString("Category")
CategoryCombo.Items.Add(sName)
CategoryCombo2.Items.Add(sName)
CategoryCombo3.Items.Add(sName)
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
Call New_Connection()
Try
MysqlConn.Open()
Dim query As String
query = "SELECT * FROM cspmatrix.elements WHERE Category ='" & CategoryCombo.Text
& "'"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
ElementCombo.Items.Clear()
elementEdit.Clear()
While reader.Read
Dim sName = reader.GetString("Element")
ElementCombo.Items.Add(sName)
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
Private Sub Populate_element_Tab2()
Call New_Connection()
Try
MysqlConn.Open()
Dim query As String
query = "SELECT * FROM cspmatrix.elements WHERE Category ='" & CategoryCombo2.Text
& "'"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
ElementCombo2.Items.Clear()
SubelementCombo.Items.Clear()
subelementEdit.Clear()
While reader.Read
Dim sName = reader.GetString("Element")
ElementCombo2.Items.Add(sName)
112
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
Private Sub Populate_SubElement_Tab2()
Call New_Connection()
Try
MysqlConn.Open()
While reader.Read
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Tab 1
'Populate Category ComboBox
Private Sub NewElement_Load(sender As Object, e As EventArgs) Handles MyBase.Load
populate_category()
End Sub
'show up Elements if certain Category is selected Tab 1
Private Sub CategoryCombo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles
CategoryCombo.SelectedIndexChanged
Call Populate_element()
End Sub
'Show up in Edit if an Element is selected in 1st Tab
Private Sub ElementCombo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles
ElementCombo.SelectedIndexChanged
Call New_Connection()
Try
MysqlConn.Open()
Dim query As String
query = "SELECT * FROM cspmatrix.elements WHERE Element ='" & ElementCombo.Text &
"'"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
elementEdit.Clear()
While reader.Read
elementEdit.Text = reader.GetString("Element")
113
ElementID.Text = reader.GetString("No")
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Show up in edit if category is selected
Private Sub CategoryCombo3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles
CategoryCombo3.SelectedIndexChanged
Call New_Connection()
Try
MysqlConn.Open()
Dim query As String
query = "SELECT * FROM cspmatrix.category WHERE Category ='" & CategoryCombo3.Text
& "'"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
Editcat.Clear()
While reader.Read
Editcat.Text = reader.GetString("Category")
CategoryID.Text = reader.GetString("No")
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Save Category
Private Sub addcat_Click(sender As Object, e As EventArgs) Handles addcat.Click
Call New_Connection()
Try
MysqlConn.Open()
MessageBox.Show("Category is Saved")
CategoryCombo.Items.Clear()
ElementCombo.Items.Clear()
elementEdit.Clear()
CategoryCombo2.Items.Clear()
ElementCombo2.Items.Clear()
subelementEdit.Clear()
CategoryCombo3.Items.Clear()
Editcat.Clear()
populate_category()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
114
Finally
MysqlConn.Dispose()
End Try
End Sub
'UPDATE CATEGORY
Private Sub upcat_Click(sender As Object, e As EventArgs) Handles upcat.Click
Call New_Connection()
Try
MysqlConn.Open()
MessageBox.Show("Category is Saved")
CategoryCombo.Items.Clear()
ElementCombo.Items.Clear()
elementEdit.Clear()
CategoryCombo2.Items.Clear()
ElementCombo2.Items.Clear()
subelementEdit.Clear()
CategoryCombo3.Items.Clear()
Editcat.Clear()
populate_category()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Delete Category
Private Sub delcat_Click(sender As Object, e As EventArgs) Handles delcat.Click
Call New_Connection()
Try
MysqlConn.Open()
MessageBox.Show("Category is Deleted")
CategoryCombo.Items.Clear()
ElementCombo.Items.Clear()
elementEdit.Clear()
CategoryCombo2.Items.Clear()
ElementCombo2.Items.Clear()
subelementEdit.Clear()
CategoryCombo3.Items.Clear()
Editcat.Clear()
populate_category()
115
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Tab 2
Try
MysqlConn.Open()
MessageBox.Show("Element is Saved")
CategoryCombo.Items.Clear()
ElementCombo.Items.Clear()
elementEdit.Clear()
CategoryCombo2.Items.Clear()
ElementCombo2.Items.Clear()
subelementEdit.Clear()
CategoryCombo3.Items.Clear()
Editcat.Clear()
populate_category()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
Try
MysqlConn.Open()
Dim query As String
query = "UPDATE cspmatrix.elements
Set Category ='" & CategoryCombo.SelectedItem.ToString & "', Element ='" &
elementEdit.Text & "'
WHERE No = '" & ElementID.Text & "'"
MessageBox.Show("Element Updated")
CategoryCombo.Items.Clear()
ElementCombo.Items.Clear()
elementEdit.Clear()
116
CategoryCombo2.Items.Clear()
ElementCombo2.Items.Clear()
subelementEdit.Clear()
CategoryCombo3.Items.Clear()
Editcat.Clear()
populate_category()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Delete Element
Try
MysqlConn.Open()
Dim query As String
query = "DELETE FROM cspmatrix.elements
WHERE No = " & ElementID.Text & ""
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
MessageBox.Show("Element Deleted")
CategoryCombo.Items.Clear()
ElementCombo.Items.Clear()
elementEdit.Clear()
CategoryCombo2.Items.Clear()
ElementCombo2.Items.Clear()
subelementEdit.Clear()
CategoryCombo3.Items.Clear()
Editcat.Clear()
populate_category()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'TAB 3
Try
MysqlConn.Open()
Dim query As String
query = "SELECT * FROM cspmatrix.`sub-element` WHERE `Sub-Element` ='" &
SubelementCombo.Text & "'"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
While reader.Read
subelementEdit.Text = reader.GetString("Sub-Element")
subelementID.Text = reader.GetString("No")
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Save SubElement
Private Sub subelementSave_Click_1(sender As Object, e As EventArgs) Handles
subelementSave.Click
Dim reader As MySqlDataReader
Try
MysqlConn.Open()
MessageBox.Show("Sub-Element is Saved")
CategoryCombo.Items.Clear()
ElementCombo.Items.Clear()
elementEdit.Clear()
CategoryCombo2.Items.Clear()
SubelementCombo.Items.Clear()
ElementCombo2.Items.Clear()
subelementEdit.Clear()
CategoryCombo3.Items.Clear()
Editcat.Clear()
populate_category()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Update Subelement
Private Sub subelementUpdate_Click(sender As Object, e As EventArgs) Handles
subelementUpdate.Click
Call New_Connection()
Dim reader As MySqlDataReader
Try
MysqlConn.Open()
Dim query As String
query = "UPDATE cspmatrix.`sub-element`
Set Element ='" & ElementCombo2.SelectedItem.ToString & "', `Sub-Element`
='" & subelementEdit.Text & "'
118
WHERE No = '" & subelementID.Text & "'"
MessageBox.Show("Sub-Element Updated")
CategoryCombo.Items.Clear()
ElementCombo.Items.Clear()
elementEdit.Clear()
CategoryCombo2.Items.Clear()
ElementCombo2.Items.Clear()
SubelementCombo.Items.Clear()
subelementEdit.Clear()
CategoryCombo3.Items.Clear()
Editcat.Clear()
populate_category()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Delete Subelement
Private Sub subelementDelete_Click(sender As Object, e As EventArgs) Handles
subelementDelete.Click
Call New_Connection()
Dim reader As MySqlDataReader
Try
MysqlConn.Open()
Dim query As String
query = "DELETE FROM cspmatrix.`sub-element`
WHERE No = " & subelementID.Text & ""
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
MessageBox.Show("Sub-Element Deleted")
CategoryCombo.Items.Clear()
ElementCombo.Items.Clear()
elementEdit.Clear()
CategoryCombo2.Items.Clear()
ElementCombo2.Items.Clear()
SubelementCombo.Items.Clear()
subelementEdit.Clear()
CategoryCombo3.Items.Clear()
Editcat.Clear()
populate_category()
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub
'Close
Private Sub Button2_Click_1(sender As Object, e As EventArgs) Handles Button2.Click
Me.Close()
End Sub
'Close
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Close()
119
End Sub
'Close
Private Sub cl_Click(sender As Object, e As EventArgs) Handles cl.Click
Me.Close()
End Sub
End Class
Print Result
Imports Word = Microsoft.Office.Interop.Word
Imports MySql.Data.MySqlClient
Public Sub New(ByVal name1 As String, ByVal id1 As Integer, ByVal good As Integer, ByVal
medium As Integer, ByVal bad As Integer, ByVal total1 As Integer, ByVal totalscore1 As
Integer, ByVal totalmark1 As Integer, ByVal comm As String)
InitializeComponent()
End Sub
Try
MysqlConn.Open()
Dim query As String
Dim da As New MySqlDataAdapter
Dim dr As MySqlDataReader
Dim ds, ds1 As New DataSet
query = "SELECT Name, Address, Owner, Date, Weather
FROM cspmatrix.building_list WHERE No = '" & id & "'"
command = New MySqlCommand(query, MysqlConn)
da = New MySqlDataAdapter(command)
da.Fill(ds, "Subject_Detail")
buildingname = ds.Tables(0).Rows(0).Item(0)
address = ds.Tables(0).Rows(0).Item(1)
ownername = ds.Tables(0).Rows(0).Item(2)
date1 = ds.Tables(0).Rows(0).Item(3)
weather = ds.Tables(0).Rows(0).Item(4)
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
120
Finally
MysqlConn.Dispose()
End Try
'Insert a 3 x 5 table, fill it with data, and make the first row
'bold and italic.
Dim r As Integer, c As Integer
oTable = oDoc.Tables.Add(oDoc.Bookmarks.Item("\endofdoc").Range, 5, 5)
oTable.ApplyStyleFirstColumn = Word.WdParagraphAlignment.wdAlignParagraphCenter
oTable.Range.ParagraphFormat.SpaceAfter = 5
For r = 1 To 5
For c = 1 To 5
Dim text As String
If (r = 1) Then
If (c = 1) Then
text = "No."
ElseIf (c = 2) Then
text = "Matrix"
ElseIf (c = 3) Then
text = "Score"
ElseIf (c = 4) Then
text = "Color Code"
ElseIf (c = 5) Then
text = "Finding(s)"
End If
ElseIf (r = 2) Then
If (c = 1) Then
text = "1."
ElseIf (c = 2) Then
text = "Planned Maintenance"
ElseIf (c = 3) Then
text = "1 to 4"
ElseIf (c = 4) Then
text = "Green"
ElseIf (c = 5) Then
text = green
End If
ElseIf (r = 3) Then
If (c = 1) Then
text = "2."
ElseIf (c = 2) Then
text = "Condition Monitoring"
ElseIf (c = 3) Then
text = "5 to 12"
ElseIf (c = 4) Then
text = "Yellow"
122
ElseIf (c = 5) Then
text = yellow
End If
ElseIf (r = 4) Then
If (c = 1) Then
text = "3."
ElseIf (c = 2) Then
text = "Serious Attention"
ElseIf (c = 3) Then
text = "13 to 20"
ElseIf (c = 4) Then
text = "Red"
ElseIf (c = 5) Then
text = red
End If
ElseIf (r = 5) Then
If (c = 1) Then
text = "Total Defects"
ElseIf (c = 2) Then
text = ""
ElseIf (c = 3) Then
text = ""
ElseIf (c = 4) Then
text = ""
ElseIf (c = 5) Then
text = total
End If
End If
oTable.Cell(r, c).Range.Borders(Word.WdBorderType.wdBorderLeft).LineStyle =
Word.WdLineStyle.wdLineStyleSingle
oTable.Cell(r, c).Range.Borders(Word.WdBorderType.wdBorderRight).LineStyle =
Word.WdLineStyle.wdLineStyleSingle
oTable.Cell(r, c).Range.Borders(Word.WdBorderType.wdBorderTop).LineStyle =
Word.WdLineStyle.wdLineStyleSingle
oTable.Cell(r, c).Range.Borders(Word.WdBorderType.wdBorderBottom).LineStyle =
Word.WdLineStyle.wdLineStyleSingle
oTable.Rows.Item(1).Range.Font.Bold = True
oTable.Rows.Item(1).Range.Font.Italic = True
oTable.Rows.Item(2).Range.Font.Bold = False
oTable.Rows.Item(2).Range.Font.Italic = False
oTable.Rows.Item(3).Range.Font.Bold = False
oTable.Rows.Item(3).Range.Font.Italic = False
oTable.Rows.Item(4).Range.Font.Bold = False
oTable.Rows.Item(4).Range.Font.Italic = False
Next
Next
'Insert a 3 x 5 table, fill it with data, and make the first row
'bold and italic.
123
Dim rw As Integer, clm As Integer
oTable2 = oDoc.Tables.Add(oDoc.Bookmarks.Item("\endofdoc").Range, 4, 3)
oTable2.Range.ParagraphFormat.SpaceAfter = 5
For rw = 1 To 4
For clm = 1 To 3
Dim text As String
If (rw = 1) Then
If (clm = 1) Then
text = "No."
ElseIf (clm = 2) Then
text = "Matrix"
ElseIf (clm = 3) Then
text = "Score"
End If
If (clm = 1) Then
text = "1."
ElseIf (clm = 2) Then
text = "Good"
ElseIf (clm = 3) Then
text = "1 to 4"
End If
If (clm = 1) Then
text = "2."
ElseIf (clm = 2) Then
text = "Fair"
ElseIf (clm = 3) Then
text = "5 to 12"
End If
If (clm = 1) Then
text = "3."
ElseIf (clm = 2) Then
text = "Dilapidated"
ElseIf (clm = 3) Then
text = "13 to 20"
End If
End If
oTable2.Rows.Item(1).Range.Font.Bold = True
oTable2.Rows.Item(1).Range.Font.Italic = True
oTable2.Rows.Item(2).Range.Font.Bold = False
oTable2.Rows.Item(2).Range.Font.Italic = False
oTable2.Rows.Item(3).Range.Font.Bold = False
oTable2.Rows.Item(3).Range.Font.Italic = False
oTable2.Rows.Item(4).Range.Font.Bold = False
oTable2.Rows.Item(4).Range.Font.Italic = False
Next
Next
124
'Insert another paragraph.
oPara4 = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks.Item("\endofdoc").Range)
oPara4.Range.Text = "Total marks : " & totalMark
oPara4.Range.Font.Bold = False
oPara4.Format.SpaceAfter = 0
oPara1.Range.InsertParagraphAfter()
oPara4 = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks.Item("\endofdoc").Range)
oPara4.Range.Text = "Number of defects : " & total
oPara4.Range.Font.Bold = False
oPara4.Format.SpaceAfter = 0
oPara1.Range.InsertParagraphAfter()
oPara4 = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks.Item("\endofdoc").Range)
oPara4.Range.Text = "Total score : " & totalScore
oPara4.Range.Font.Bold = False
oPara4.Format.SpaceAfter = 0
oPara4.Range.InsertParagraphAfter()
oPara4 = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks.Item("\endofdoc").Range)
oPara4.Range.Text = "Overall building rating : " & comment
oPara4.Range.Font.Bold = True
oPara4.Format.SpaceAfter = 10
oPara4.Range.InsertParagraphAfter()
oPara5 = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks.Item("\endofdoc").Range)
oPara5.Range.Text = "4.0 Recommendation"
oPara5.Format.SpaceAfter = 10
oPara5.Range.InsertParagraphAfter()
Me.Close()
End Sub
End Class
125