You are on page 1of 142

DEVELOPMENT OF VISUAL BASIC APPLICATION

TO ASSESS CONDITION OF BUILDING USING


CONDITION SURVEY PROTOCOL (CSP) 1
MATRIX: A STUDY ON UNIVERSITIES LECTURE
HALL

MOHAMED FARIHAN BIN MAIL

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

MOHAMED FARIHAN BIN MAIL

THESIS SUBMITTED IN PARTIAL FULFILMENT


OF THE REQUIREMENT FOR THE DEGREE OF
BACHELOR OF CIVIL ENGINEERING

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.

10 June 2017 Mohamed Farihan Bin Mail

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 SYMBOLS xiv

LIST OF ABBREVIATIONS xv

CHAPTER 1 INTRODUCTION

1.1 Overview 1

1.2 Definition 3

1.3 Background of Study 3

1.4 Problem Statement 5

1.5 Objectives of Study 6

vii
1.6 Scope of Work 6

1.7 Research Framework 7

CHAPTER 2 LITERATURE REVIEW

2.1 Introduction 9

2.2 Computer Programming 9

2.2.1 Visual Studio 11

2.2.2 Programming Languages 13

2.2.3 Language Comparison 14

2.2.4 Visual Basic .NET 15

2.3 Condition Assessment 17

2.3.1 Asset Hierarchy 18

2.3.2 Evaluation Mechanism 19

2.3.3 Field Inspection and Data Collection 21

2.3.4 Condition Analysis 22

2.3.5 Condition Survey Protocol (CSP) 1 Matrix 23

2.4 Lecture Hall 27

2.4.1 Types of Lecture Hall 28

viii
2.4.2 Acoustics 31

2.4.3 Lighting 32

2.4.4 Seating 32

2.4.5 Thermal Comfort 33

2.4.6 Audio-Visual System 33

2.6 2.4.7 Building Elements 34

CHAPTER 3 METHODOLOGY

3.1 Introduction 44

3.2 Acquiring Real World Data 47

3.3 Software Development 48

3.1.1 Program Software Design 49

3.3.2 Implementation and Coding 50

3.3.3 Program Testing 56

3.3.4 Deployment 58

3.4 Analysis 59

CHAPTER 4 RESULTS AND DISCUSSION

4.1 Introduction 60

ix
4.2 Developed Application / Software 60

4.3 Building Rating 67

4.3.1 Dewan Kuliah Pusat 1 (DKP1), UMS 68

4.3.2 Dewan Kuliah Awam (DKA), PKK 73

CHAPTER 5 CONCLUSION AND RECOMMENDATION

5.1 Introduction 80

5.2 Conclusion 80

5.3 Limitation 81

5.4 Recommendation 81

REFERENCES 82

APPENDICES

APPENDIX A Executive Summary for Dewan Kuliah Pusat 1 (DKP1), UMS 89

APPENDIX B Executive Summary for Dewan Kuliah Awam (DKA), PKK 90

APPENDEX C Source code of every window 91

x
LIST OF TABLES

Table No. Page

2.1 Differences of three popular programming languages. 14

2.2 Rating scale & linguistic representations. 20

2.3 Condition Assessment Protocol 1. 24

2.4 Priority assessment. 24

2.5 The Descriptive Value According to Score. 25

2.6 Overall building ratings. 25

2.7 Advantage and disadvantage of different form of lecture hall. 30

4.1 Schedule of building Condition for DKP 1, UMS. 69

4.2 Number of defects according to category for DKP 1, UMS. 71

4.3 Number of defects according to building element for DKP 1, 72


UMS.

4.4 Schedule of building Condition for DKA, PKK. 74

4.5 Number of defects according to category for DKA, PKK. 76

4.6 Number of defects according to building element for DKA, PKK. 77

4.7 Summary of result for both lecture halls. 78

xi
LIST OF FIGURES

Figure No. Page

1.1 Research framework. 8

2.1 Compilers turn source code from high level language into 10
instruction that the computer can understand.

2.2 Components of IDM inside Visual Studio. 11

2.3 Main Steps In the Condition Assessment Process. 18

2.4 Condition scale and linguistic representation. 20

2.5 The matrix. 25

2.6 Example of executive summary. 26

2.7 Multiple-aisle arrangement. 28

2.8 Continental arrangement 29

2.9 Example of commonly used forms for Lecture Theater. 30

3.1 Flowchart for development of project. 46

3.2 Waterfall model. 48

3.3 Sequence for the CSP 1 Matrix. 49

3.4 Creating new Windows Form Application in New Project. 50

xii
3.5 Adding New Item into Empty Form. 51

3.6 Code editing window. 51

3.7 Code for new sever connection. 52

3.8 Code for selecting which data from database. 52

3.9 Code for displaying data to DataGridView. 53

3.10 Code for displaying data to textboxes. 53

3.11 Code for displaying binary data to photobox. 53

3.12 Code for inserting data to database. 54

3.13 Code for converting image to binary. 54

3.14 Code for deleting data from database. 55

3.15 Code for updating data to database. 55

4.1 Splash Screen. 61

4.2 Form 1 (Main Window). 62

4.3 Form 2 (Defect List Window) 63

4.4 Form 3 (Detail View Window). 64

4.5 Microsoft Office Document. 65

4.6 Form 4 (Add Defect Window). 65

xiii
4.7 Form 6 (edit defect window). 66

4.8 Form 7 (Element Window). 67

4.9 Location of defect at DKP1, UMS. 70

4.10 Location of defect at DKA, PKK. 75

xiv
LIST OF SYMBOLS

clo Clothing Insulation

Facility Condition Index

Wave Speed

Integration constant

xv
LIST OF ABBREVIATION

ASHRAE American Society of Heating, Refrigerating and Air-Conditioning


Engineers

ANSI American National Standard Institute

AV Audio-Visual

BASIC Beginners All-purpose Symbolic Instruction Code

CIBSE Chartered Institute of Building Services

CPU Central Processing Unit

CSP Condition Survey Protocol

dB Decibel Level

DIN Deutsches Institutfr Normung

DKA Dewan Kuliah Awam

DKP Dewan Kuliah Pusat

IDE Integrated Development Environment

ISE Integrated Systems Europe

MDF Medium Density Fiberboard

OBS Organizational Breakdown Structure

xvi
OSH Occupational Safety and Health

PKK Politeknik Kota Kinabalu

RICS Royal Institute of Chartered Surveyors

RH Relative Humidity

RT Reverb Time

SDLC Software Development Life Cycle

SII Speech Intelligibility

UMS Universiti Malaysia Sabah

VB Visual Basic

xvii
CHAPTER 1

INTRODUCTION

1.1 Overview

Condition assessment is important to ensure a building stays in check, no matter it is

a newly constructed building or existing building. 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. Condition assessment is one of many

ways to maintain a building as it is generally conducted with the purpose to assess

the buildings condition. Condition assessment is typically related to buildings

performance that could impact users life and decision making.

Traditionally, building surveyors have primarily relied on descriptive longhand

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

component based on his/her own judgment or in other terms, describing based on

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

descriptive longhand surveys time consuming as surveyor have to translate and

analyses descriptive data to presentable information. This is crucial when factoring

new surveyor to assess any property or asset condition as it requires their judgment,

experience and competency in analyzing descriptive information.

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

new way of surveying building condition involves utilization of rating instead of

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

have to give certain value to the particular defect.

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

gives the building an overall score.

With the utilization of rating instead of description, computation of result can

be done with more precise and quick; data will be able to be present instantly as

there is no need translate complex descriptive into presentable outcome. Although

the end result achieved is considered quick and precise, the system still requires

analysis and computation by human hand. In order to make condition assessment

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

around Kota Kinabalu.


2
1.2 Definition

Windows application is a program that is written in language to run under the

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

that allows you to program sophisticated applications.

CSP 1 Matrix is a newly developed matrix system designed to evaluate

condition of a building for condition assessment. It involves utilization of rating

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

other way around.

1.3 Background of Study

According to Friedman J. P. (2009), building inspection is a physical review of a

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.

Referring to Queensland Department of Housing and Public Works (2012),

condition assessments are an important aspect of effective maintenance planning.

The incorporation of condition assessments as part of maintenance processes

ensures that there is a structured, objective process for identifying the demand for

condition-based maintenance works to meet strategic and operational priorities. Such

works should form part of any comprehensive program of maintenance in

conjunction with preventative, statutory and reactive (unplanned) maintenance work,

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

order to keep the building in the original states.

Building performance and condition assessment could not be separated as

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 building performance. The performance of a building can be viewed roughly by

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

Using CSP 1 Matrix, condition of lecture hall of learning institution around

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

around Kota Kinabalu.

1.4 Problem Statement

Building inspection is traditionally conducted by using descriptive information. These

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

defect description on site in addition to translate and analyse descriptive data to

presentable information. By using building condition rating approach suggested by

Royal Institution of Chartered Surveyors (RICS) Homebuyers Service 2009 (3rd

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

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 needed for manual calculation need to be done. Thus, the need

to develop a Windows application that can calculate and produce result automatically

with user input is necessary to reduce the limitations.

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

needed on assessment of building condition using CSP 1 Matrix.

Condition assessment is important as it is the key element in managing

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

condition of lecture hall in detail whether the building is providing a conductive

learning environment or not.

1.5 Objectives of Study

The study is conducted with following objectives:

a) To develop Windows Application that can compute score of building based

on CSP1 Matrix.

b) To assess condition of Dewan Kuliah Pusat 1 of Universiti Malaysia Sabah,

Dewan Kuliah Awam of Politeknik Kota Kinabalu and using CSP1 Matrix.

c) To obtain and compare overall building rating for several lecture hall of

educational institution around Kota Kinabalu.

1.6 Scope of Work

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

significant impact on learning and teaching process in universities across Malaysia.

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.

1.7 Research Framework

During preliminary research, research framework was constructed as shown in Figure

1.1. Research framework provides a context for examining a problem. Research

framework is rationale for:

i) Developing hypothesis.

ii) A frame of reference.

iii) Serves as guide to systematically identify logical and precise defined

relationship among variables.

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.

Foundation to write Select research Methodology:


1. Literature review on Computer
LITERATURE REVIEW
Programming, Condition Assessment and
1. Computer Programming
2. Condition Assessment lecture hall.
3. Lecture Hall 2. Site inspection.
3. Development of computer software.

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.

RESEARCH QUESTION PROBLEM STATMENT SIGNIFICANT OF


1. Building assessment using CSP 1 RESEARCH
1. How the application can Matrix still need time to evaluate. 1. Improve building
help surveyor? 2. Evaluation of lecture hall not been inspection efficiency.
developed using CSP 1 Matrix. 2. Know the condition
2. How is the condition of 3. Need system to assess condition of universities lecture
lecture hall of of lecture hall to provide quality hall.
universities? learning environment. 3. Research on
4. More study needed on assessment assessment using
using CSP 1 Matrix. CSP 1 Matrix.

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.

Figure 1.1: Research framework.

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

key element on conducting a condition assessment of a building while complying with

the standards available.

2.2 Computer Programming

Programming is defined as a general human activity, to mean the act of extending or

changing a systems functionality. Programming is the art of writing instructions that

a computer can executes (Combs T. & Campbell J., 2001). Saved in one file, these

sets of instruction are known as a program. Programming is telling a computer how it

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

complex arithmetic computations, with the right programming software, computers

also can perform many other tasks like accepting, sorting, selecting, moving and

comparing various types of information. The information provided by user is called

data.

After creating sets of instruction, all the sets of instructions need to be

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

finished executable program, assuming there were no errors. The executable

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

Find Errors Compile

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

improving as well, resulting in development of more advance compilers and the

concept of an Integrated Development Environment (IDE) (Mackanzie D. & Sharkey

K., 2002). The concept of IDE means to combine the editing, debugging and

compiling components of software development into a single interface for

programmers.

2.2.1 Visual Studio

Visual Studio is Microsofts Integrated Development Environment (IDE) for creating,

running and debugging programs (also called applications) written in verity of

programming languages (Deitel et al., 2002). Integrated development environment

(IDE) is a software application that provides comprehensive facilities to computer

programmers for software development. The purpose of an IDE is to provide a single

environment for users to work in, but it still uses the same sequence of

edit/compile/execute as the manual process (Mackanzie D. & Sharkey K., 2002).

Microsoft Visual Studio revolutionizes Windows software application development as

it can create run and debug program written in multiple programming languages.

Figure 2.2 shows components of Integrated Development Environment (IDM) inside

Visual Studio.

Visual Studio
Integrated Development Environment

Visual Designers Code Editors Tool Windows

Service to call compilers Runtime debugging support

Figure 2.2: Components of IDE inside Visual Studio.


Source: Mackanzie D. & Sharkey K. (2002)
11
Microsoft supplies four Visual Studio languages: C++, C#, Visual J# and

Visual Basic (Ekedahl, M. V. 2004). In recent version of Microsoft Visual Studio

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 supplies nearly identical functionality so the decision of which Visual

Studios language to use is no longer on the features provided by a particular

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,

the language chosen by programmers does not matter.

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

how an application is installed on their computers. The Visual Studio deployment

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

program using chosen language, it is valuable to understand the difference between

the IDE and its underlying language.

2.2.2 Programming Language

The old definition for programming language is "a notation for communicating to a

computer what we want it to do". However, this definition is inadequate. Before

1940s, computers were programmed by being "hard-wired": switches where set by

programmer to connect the internal wiring of the computer to perform requested

task (Louden K. C., 2003). To instruct these computers, early computer programmers

have to enter a series of number by flipping switches manually. The earliest

computer programming language was quite minimal (Salvage J., 2003).

Programming languages simply the definition of instruction developer want computer

to execute (Combs T. & Campbell J., 2001). Programming language or machine

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. &

Campbell J., 2001).

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

programmers to express solutions to programming problems in terms that are much

closer to a natural language like English (Halterrman R. L., 2016).

2.2.3 Language Comparison

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

years, choosing programing language nowadays is just a matter of personal

preference. Table 2.1 shows brief difference between these three popular

programing languages.

Table 2.1: Differences of three popular programming languages.

C++ Java Visual Basic .NET

Object-Oriented Object-Oriented Object-Oriented


Programming Language Programming Language Programming Language

Derived from C & C++


Derived From C Derived from BASIC
but simpler object model
Gradually acquiring
Hybrid / Multiple Built from ground up as
complete object-oriented
Paradigm object-oriented language
capabilities
Very complex. The More telling in order to
learning curve is steep accommodate new Ease of development as its
and takes a long time to object-oriented and other derived from BASIC
climb functionality

14
C++ programming language is known to be very efficient in world of

programming as it compiles into highly optimised CPU-specific machine code with

little or no runtime overhead. This is highly beneficial if programmer is building

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.

This ultimately consumes a lot of time to be learned. Similarly, Java programming

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

for this study

2.2.4 Visual Basic .NET

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

Basic language is a descendent of the original BASIC (Beginners All-Purpose

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

object-oriented programming language for writing event-driven Windows Application

(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

resemblance to BASIC. None of the less, the core of VB language is identical

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

that is identical across its various host (Lomax P., 1998).

Microsoft Visual Basic .NET for Windows (VB .NET) allows Engineers to

develop engineering applications that run in the Windows environment (Torres D. E.

& 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

their needs as it is relatively easy to learn and use. Development of a Windows-like

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.,

2003). Furthermore, because it is descendent of the original BASIC language, it is

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

start programming. Visual Basic .NET is an event driven program where

programmers have to assign code to response to certain event triggered randomly by

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

is chosen for this project.


16
2.3 Condition Assessment

Condition assessments are technical inspections by competent assessors to evaluate

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

appropriate strategies and actions for maintenance, major replacements,

refurbishments and investment. A lack of such knowledge could result in premature

asset failures, shorter useful asset lives, higher repair and replacement costs, all of

which ultimately affect service delivery capacity and quality.

Referring to Queensland Government Maintenance Management Framework:

Building Condition Assessment (2012), Condition assessment comprise of physical

inspection of a building to assess the actual condition of the building. Secondly,

identification of maintenance works required to bring the condition of the building

and its services up to or maintain it at the specified condition standard. Lastly,

determination by the assessor of actions to mitigate any immediate risk until

remedial works (or other actions) can be taken to address problems.

Condition assessment is a process of predicting the maintenance strategies

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

of process to make it useful to assist in decision making of maintenance future

planning (Wahida R. N., 2012). Singh, A. S. (2008) stated that there are about four

main steps involves in condition assessment as shown in the Figure 2.3.

17
Asset Hierarchy Evaluation Mechanism

Inspection Level Condition Scale, Required Data&


Inspection Techniques Required Analysis

Condition Assessment Field Inspection

Rate Inspected Components Defect Deficiencies


Calculate Condition at any Level in Measure Severities
the Hierarchy Add Notes, Pictures, etc.

Figure 2.3: Main Steps In the Condition Assessment Process


Source: Singh, A. S. (2008)

2.3.1 Asset Hierarchy

Hierarchy is one of the important steps in condition assessment. The hierarchy is

intended as a means to classify and cluster these components in different categories.

The hierarchy is intended as a means to classify and cluster these components in

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

(Singh, A. S., 2008).

18
A study by Elhakeem (2005) combined the benefits of existing hierarchies and

suggested a five-level (system, subsystem, component, type/element, and instance)

building hierarchy to correspond to the Organizational Breakdown Structure (OBS) of

educational organizations (e.g. school boards). The main benefits of the proposed

hierarchy are to facilitate the process of revising assessed components, to evaluate

the performance of each department in keeping its components in a safe and

satisfactory condition and to permit the organization of possibly organize the

allocation of funds among various systems according to organizational preferences.

2.3.2 Evaluation Mechanism

Much research has been directed towards identifying proper evaluation criteria in

order to assess the performance of building components (Chew et al., 2003). The

condition of a single instance of a component can be evaluated either or both of two

approaches: a distress survey and a direct-condition rating survey (Uzarski D. R.,

2002). Uzarski reported that the distress survey procedure is an accurate and

reproducible approach. It provides a record of what needs to be fixed in the

inspected instance. The direct-condition rating approach is less accurate but much

faster. It involves a visual inspection of each component and an evaluation of that

item against a set of criteria.

In any system, the values of the condition indexes provide the means of

comparing the condition of various components. The condition index scale for

building components is usually from 0 to 100, where 0 represents a critical (failure)

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

L. A., 1997). Other examples of condition scales and corresponding linguistic

representations are listed in Table 2.2.

Figure 2.4: Condition scale and linguistic representation.


Source: Singh, A. S. (2008)

Table 2.2: Rating scale & linguistic representations.


Asset Condition
Reference Linguistic Representation
Type Scale
Lee and Aktan Deterioration: (1 = no, 2 = slight, 3 = moderate, and 4 =
Buildings 1-4
1997 severe)

Elhakeem and Deterioration: (0 - 20) = no, (20 - 40) = slight, (40 - 60) =
Buildings 1-100
Hegazy 2005 moderate, (60 - 80) = severe, and (80 - 100) = critical

Maintenance need: [(0 - 39) = only after further


Greimann et Locks and
1-100 investigation, (40 - 69) = only if economically feasible, and
al. 1997 Dams
(70 - 100) = no action is required]

Lounis et al. Condition category: (1 = failed, 2 = very poor, 3 = poor, 4


Any Asset 1-7
1998 = fair, 5 = good, 6 = very good, and 7 = excellent)

Deterioration process: (1 = protected, 2 = exposed, 3 =


Pontis 1995 Bridges 1-5
vulnerable, 4 = attacked, and 5 = damaged)

Che-Ani, A. et Action need: (1-4) = planned maintenance, (5-12) =


Buildings 1-25
al. 2010 condition monitoring, (13-20) = Serious attention

20
2.3.3 Field Inspection and Data Collection

Evaluating the condition of building components using a distress survey requires full

knowledge of the deficiencies possible in each component. To accurately detect these

distresses and measure their severity, a systematic approach to field inspection is

crucial. The goal of the inspection process is to obtain the data required in order to

measure and/or calculate performance or to evaluate the condition (calculating a

numeric value that reflects a specific condition) (Singh, A. S., 2008).

Inspection should be performed consistently, accurately, and as objectively as

possible. To ensure uniformity in assessment, training for inspectors is

recommended. To standardize the process, many researchers have developed

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

During field inspection, there are steps or flow in conducting inspection.

Normally, building inspection is conducted from outside perimeter, to external of the

building and lastly, interior of the building. First, external building conditions are

surveyed, followed by internal inspection. Houses are generally inspected in

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

on asset hierarchy established. These inspection rules therefore simplify the

determination of possible causes of internal defects (Che-Ani et al., 2014).

21
2.3.4 Condition Analysis

After obtaining data by the inspection process is in the form of measurements of the

severity of the deficiencies of a component, analysis is required in order to translate

these measurements into a condition value. Once the condition of a component is

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

of evaluation method (direct-condition rating or distress rating) (Singh, A. S., 2008).

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

considered as standard tool, which is used by architects, engineers, and facility

planners to compare the condition of school facilities and determine whether it is

more economical to fully modernize an existing school or to replace it (NCES, 2003).

The cost to correct deficiencies equals the estimated total costs to repair all

life-cycle, maintenance, and design deficiencies. Replacement value is the cost to

replace an existing structure with a new structure of the same size at the same

location, which can be calculated as follows:

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.

Depending on element of building based on assets hierarchy, the format of the

matrix will still able to accommodate any condition of survey work. The goals of CSP

1 Matrix are:

i) To enable the surveyors to collect data within shortest possible time by

avoiding descriptive, longhand write-ups during fieldwork.

ii) To record the existing defects of the building, the main source of data, by

assessing the condition and assigning priority to each defect recorded.

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

cannot be carried out immediately after the surveys completion because of

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.

Condition Scale Value Description

1 Good Minor Servicing

2 Fair Minor Repair


3 Poor Major Repair/Replacement
4 Very Poor Malfunction
5 Dilapidated Damage/Replacement of Missing Part

Source: Hamzah et al. (2010)

Table 2.4: Priority Assessment.

Condition Scale Value Description

1 Normal Functional; cosmetic defect only


Minor defect, but could become serious if left
2 Routine
unattended
Serious defect, doesnt function at an
3 Urgent
acceptable standard
Element/structure doesnt function at all; or
4 Emergency Presents risks that could lead to fatality
and/or injury

Source: Hamzah et al. (2010)

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

parameters: Plan Maintenance (1 to 4), Condition Monitoring (5 to 12) and Serious

Attention (13 to 20), as shown in Table 2.5 (Hamzah et al., 2010).

24
Figure 2.5: The Matrix.
Source: Hamzah et al. (2010)

Table 2.5: The descriptive value according to score.

No. Matrix Score


1 Planned Maintenance 1 to 4

2 Condition Monitoring 5 to 12
3 Serious Attention 13 to 20

Source: Hamzah et al. (2010)

After scoring every defect, the overall building rating which summarises the

buildings condition will be calculated. Average value of score will be calculated by

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

Lastly, an executive summary is produced and presented. Figure 2.6 shows an

example of executive summary produced after analysis.

Table 2.6: Overall building ratings.


No. Building Rating Score

1 Good 1 to 4

2 Fair 5 to 12
3 Dilapidated 13 to 20

Source: Hamzah et al. (2010)


25
Figure 2.6: Example of executive summary.
Source: Hamzah et al. (2010)

26
2.4 Lecturer Hall

Lecture hall also known as Lecture Theater is a large room associated with education

that typically found at university or collage. Normal classroom is typically designed to

house 1 to 50 students. However, the number student housed in lecture hall often

vary to the standard of each individual university. Referring to Division N of

University of Pittsburghs Classroom and Lecture Hall Design (2003), classrooms

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.

That is to help deliver.

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

that should consider in schools environment. In order to maximize the performance

of lecture hall, few characteristic related to requirements of good lecture hall need to

be understood. Characteristic such as acoustic, lighting, seating, thermal comfort and

audio-visual system are important in designing an effective lecture hall. According to

Pennsylvania State University Classroom & Technology Design & Construction

Minimum Requirements (2009), understanding these characteristic not only allow us

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

are basically two types of lecture hall seating arrangements, multiple-aisle

arrangement and continental arrangement. A multiple-aisle arrangement usually has

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

limits established in a multiple-aisle arrangement. In order to compensate for 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

between multiple-aisle and continental arrangement (Theatre Solution Inc., 2016).

Figure 2.7: Multiple-aisle arrangement.


Source: Theatre Solution Inc. (2016)

28
Figure 2.8: Continental arrangement
Source: Theatre Solution Inc. (2016)

Based on these arrangements, there are several theater form used in

conventional theatre hall. Form is the result of planned relationships between

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

Solution Inc., 2016).


29
Figure 2.9: Example of commonly used forms for Lecture Theater.
Source: Theatre Solution Inc. (2016)

Table 2.7: Advantage and disadvantage of different form of lecture hall.

Form Advantage Disadvantage

Not very conducive to close


Well suited to lecture film or
End Stage relationship between performer
slide presentations.
and spectator.

Brings distant spectators Limits space usage to primarily


Wide Fan
closer to the performer. speech related activities.

Improves the hearing and


Film presentation is almost out of
Arena visual contact between
the question.
spectator and performer.

Offers 360 degree visuals,


This limits the arena physically, it
Arena bringing more spectators
allows very little (or no) expansion.
closer to the performers.

Source: Theatre Solution Inc. (2016)

30
2.4.2 Acoustics

Acoustics plays an important role in performance of lecture hall in delivering lecture

performance. It has been clearly documented that an individuals learning ability is

enhanced by a classroom with ideal acoustics (Bauman E. & Averett, 2008). As the

acoustic performance of the environment impacts the outcome of learning process, it

is important to assess the situation and promote the lecture halls environment which

makes everyones interest in listening and being involved in communication (Youssef

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

(Bauman E. & Averett T., 2008).

Sound is originated from the source of the sound such as loudspeakers,

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

lighting can improve students learning performance. Study conducted by Samani S.

A. (2012), show that good lighting classrooms can motivate students for better

learning. Providing an appropriate lighting quality with the combination of daylight

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

provide better learning in lecture hall.

2.4.4 Seating

As discussed previously, seating arrangements becomes the general indicator of

several types of lecture hall. Based on study conducted by previous researcher, it

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

in the front rows of a high-enrollment introductory physics class (Physics 1010,

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

maximize potential and minimize student distraction.

2.4.5 Thermal Comfort

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

discomfort and ultimately cause distraction. In order to ensure good performance of

lecture hall, thermal comfort of the lecture hall must meet to the requirement and

standard. Based on ASHRAE Standard 55 (2004), Thermal Environmental Conditions

for Human Occupancy specifies thermal conditions which will be acceptable to 80%

or more occupants in a building if dressed appropriately. According to ASHRAE

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

with 60% RH and air speed of <0.25 m/s (OSH, 2007).

2.4.6 Audio-Visual System

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

of audiovisual technology facilitates engagement and communication within lecture

theatres due to the ability to control visual imagery and sound simultaneously for the

purpose of the presentation that is to be communicated. Electronic lecture halls or

33
(electronic) teaching theaters have been installed in many universities and colleges

all over the world. These installations typically include high quality projection of

computer displays, video conferencing facilities, and often also computer-based

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

to students performance. Malfunction AV system may cause complication of lecture

delivery in lecture hall that ultimately affect students performance.

2.4.7 Building Elements

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

role to the performance of lecture hall.

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.

a) External Walls Primary function of external wall is to protect inner part of a

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:

i) Concrete Concrete is an artificial stone-like material used for various

structural purposes. It is made by mixing a binding material such as

cement and various aggregates and water. Traditionally, concrete is the

mixed with cement, sand, as fine aggregate, granite or sandstone as

coarse aggregate and water. However, these aggregates can be replaced

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

harden by hydration. Concrete is generally strong in compressive force

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

is normally composed of clay, sand and lime. However different type of

brick can be made from adjusting or replacing the amount of composition.

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

the bond between brick and mortar.

b) Roofs Roof is a structure that provides upper covering of a building. As part of

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

periodic costly maintenance that other roofing materials often require. In

addition, metal roof is also environmentally friendly as Metal roofs not

only have 25% to 95% recycled content, depending on the material

used, but are also 100% recyclable at the end of their life as a roof.

ii) Polycarbonate Polycarbonate panels can withstand force and are

virtually unbreakable. Polycarbonate roofs have a high level of UV light

blocking ability. They are a long lasting roofing material but the material

itself is made with a process that is not eco-friendly. Advantage of using

Polycarbonate is that, they are resistant to heat, sunlight, snow, and rain,

which enable them to last for many years without fading or discoloring.

iii) Aluminum Aluminum roofing material is a good choice for Malaysia as

the material reflects sunlight and heat better than almost any other

roofing material. It is a versatile rooking material, available as a panel,

tile or shingle. Lightweight and environmentally friendly, aluminum is a

low risk choice for most roofing projects.

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

to block off and allow connection to outside environment within an enclosed

space. Door and window has an interior inside space and exterior side that face

outside of that space. According to design criteria for classroom, University of

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

60, it is recommended to use 2 out-swinging doors per room. Windows on the

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.

i) Wood Wood is still most popular choice of material for construction of

doors, windows and ventilators because of ease of cutting, shaping and

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

that, wood give very good or attractive looks in the building.

ii) Aluminum Light yet strong, aluminum windows and doors can be

configured into a wide variety of combinations. Normally, standard

extruded aluminum alloy sections are used for fabrication of aluminum

doors and window frame. The advantage of using aluminum is it provides

stability to a doors. In addition, they also provide weatherproof qualities.

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

expert cannot differentiate between them. Advantage of using fiberglass

is that it requires minimal maintenance while offering beautiful wood-grain

or smooth finish looks.

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

rain water off the building.

i) Trench drain Drainage can either natural or artificial removal of

surface and sub-surface water from an area. Usually made from concrete,

drainage can be constructed in-situ or by using precast and underlay with

polymer or metal based materials. Channel can range from 25 mm to

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

slope or placed discretely through metal that is suspended beyond the

roof.

38
II) Interior

Interior of lecture hall is important in order to provide the effective learning

environment. Materials for interior must be chosen properly in order to provide

comfortable learning environment. One of the considerations of choosing material for

wall and ceiling is that they must be able to absorb sound in order to give maximum

learning performance.

a) Wall As mentioned previously, materials normally used building wall for

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

added to the wall.

i) AFB Rockwool Insulation (Acoustical Fire Batts) is great

soundproofing material in its own. The material is made of winning

combination of soundproofing and thermal insulation. Its low cost and

wide availability make it great choice for sound dampening material.

ii) Soundproof Foam Panels Soundproof (acoustic) foam is a specially

formed material designed to deflect, dampen and absorb unwanted

sounds. Commonly used in studios and home theater and entertainment

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.

i) Carpet Carpets come in variety of materials including wools, nylon,

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

are composed of looped fibers set into the carpet backings.

ii) Laminate Made from plywood or medium density fiberboard (MDF)

with plastic laminate on top layer, laminate is a floor covering that

appears similar to hardwood. Laminate may be more durable than

hardwood, but it cannot be refinished like hardwood.

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

with mortar. However nowadays, it is filled with sanded or unsanded floor

grout.

Ceiling ceiling in lecture hall must be fitted with sound reflecting elements above

the speaker and throughout. It is important that to enable sound to be angled so

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

sound reflecting materials.

III) Services

Services are systems installed in buildings to make them comfortable, functional,

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,

audio-visual system and air conditioning.

a) Lighting As discussed previously, lighting is important to performance of

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.

b) Audio-Video (AV) system Audio-Visual system plays a crucial part in lecture.

Audio-video system allows speaker or lecturer to deliver information that they

want the audience to hear.

i) Projector A projector or image projector is an optical device that

projects an image or moving images onto a surface, commonly a

projection screen. Most projectors create an image by shining a light

through a small transparent lens, but some newer types of projectors can

project the image directly, by using lasers. A virtual retinal display, or

retinal projector, is a projector that projects an image directly on the

retina instead of using an external projection screen.

ii) Speaker A speaker is a term used to describe the user who is giving

vocal commands to a software program. A hardware device connected to

a computer's sound card that outputs sound generated by the computer.

The original computers released had on-board speakers that generated a

series of different tones and beeps. As multimedia and games became

popular, higher quality computer speakers began to be released that

required additional power.

iii) Projection Screen Projection Screen consist of surface (white curtain)

and a support structure. Projection screen is usually used for displaying a


41
projected image from projector. Projection Screen may be permanently

installed, painted on walls or portable with a tripod or floor rising models.

In lecture hall, the typical projection screen used is permanent projection

screen and it can be pull-down or by electric mechanism. Usually, they

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

conditioning a more comfortable interior environment can be achieved. There are

several installation types for air condition; Window unit or packaged terminal,

split system and central (ducted) air conditioning.

i) Window unit or packed terminal Window unit air conditioner are

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

way with the difference of its mounted on wall.

ii) Mini-split (ductless) System Mini-split system may supplies air

conditioned and heated air to a single or a few rooms of a building. This

multiple zone system allows the application of the air conditioning up to 8

rooms as it typically split the indoor unit allowing the compressor and

heat exchanger to be placed farther away from the inside space.

iii) Central (ducted) air conditioning Central (ducted) air conditioning

offers whole-house or large commercial space cooling and often offers

moderate multi-zone temperature control capability with addition of air

louver control boxes. In central air conditioning, the inside heat-


42
exchanger is typically placed inside furnace unit of the forced air heating

system.

IV) Substructure

Substructure is an underlying or supporting the structure to superstructure.

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.

a) Foundation Foundation also can be called as base. A building will completely

stand on foundation. Thus, making it the most important part of a building.

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

used to transfer the load deeper, more competent strata at depth.

b) Tie Beam or grade beam Tie beam or grade beam does not carry any

vertical load. Instead, it is constructed in order to tie columns to prevent lateral

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.

Instead, it is called ground 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

whole development of the project.

Normally in software development, there are four general stages that

software product must through several stages.

i) Identifying Problem

ii) Program Design

iii) Implementation and Coding

iv) Program Testing

v) Deployment

Since software development stage of identifying problem was discussed in

previous chapter, in this chapter, the process of developing the programming

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

world data, program software construction and design, implementation and

programming, testing and lastly, analysis. Overall, there are 5 phases towards the

process of software development and application of real world data.

44
Real world data will be acquired by the process of site inspection & data

collection for condition assessment as outlined by Singh, A. S. (2008). Program

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

consuming longer time than design phase.

45
Title of Project

Objectives

Problem Statement

Planning

Methodology

Acquiring Data
Literature
Review Design of CSP 1 Program

Implementation and Coding

Testing

Analysis

Result

Limitation and Improvement

Conclusion

Figure 3.1: Flowchart for development of project.

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

(DKA) of Politeknik Kota Kinabalu (PKK).

Site inspection will be conduct in accordance to Che-Ani et al., 2014 where

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.

First, external building conditions are surveyed, followed by internal inspection.

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

level of the building may influence the lower levels.

In addition, inspection will be conducted with a clockwise direction, starting

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

inspect thoroughly based on asset hierarchy established. These inspection rules

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

drawing or plan of the particular building.

47
3.3 Software Development

As discussed, there are several phases in software development, In helping the

application development process, it is best to have a diagram that shows the

workflow of the programing application whether it designing a new program or

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

sequential development approach, in which development is seen as flowing steadily

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

model showing phases in development of CSP 1 Matrix software.

Identifying
Problem

Programming
Software
Design

Implementation
and Coding

Program Testing

Deployment

Figure 3.2: Waterfall model.

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

development, which is programming software design phase. In this phase, the

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

system architecture before software design is prepared. After a conducting a

thorough in previous chapter, sequence of the way the program needs to run can be

identified. The developed application/software will be called "CSP Program". By the

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

Figure 3.3: Sequence for the CSP 1 Matrix.

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.

Figure 3.4: Creating new Windows Form Application in New Project.

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

empty form. This includes, a DataGridView, comboboxes, tectboxes and buttons.

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.

Figure 3.6: Code editing window.

51
In order to achieve the requirement of displaying information in the program,

a connection code is required to connect and communicate to MySQL Sever . New

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

ID and password set (Figure 3.7).

'New connection to sever


Private Sub New_Conn()
MysqlConn = New MySqlConnection
MysqlConn.ConnectionString = "server=localhost;" _ & "uid=root;" _ &
"pwd=password123;" _ & "database=csp;"
End Sub

Figure 3.7: Code for new sever connection.

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

building_list from dome database.

'Load data to Data Grid View


Dim query As String
Dim sda As New MySqlDataAdapter
query = "SELECT * FROM csp.building_list"
cmd = New MySqlCommand(query, MysqlConn)
sda.SelectCommand = cmd

Figure 3.8: Code for selecting which data from database.

To displaying the selected information from database to the window requires a

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

Figure 3.9: Code for displaying data to DataGridView.

Dim da As New MySqlDataAdapter


Dim ds, ds1 As New DataSet

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)

Figure 3.10: Code for displaying data to textboxes.

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

stream (Figure 3.11).

Dim ds As New DataSet


Dim img() As Byte

img = ds.Tables(0).Rows(0).Item(3)
Dim ms As New MemoryStream(img)
Photo1.Image = Image.FromStream(ms)

Figure 3.11: Code for displaying binary data to photobox.

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,

assessment, score and image into the database.

Dim query As String


query = "INSERT INTO csp.defects (Category, Element, Location, `Condition`,
Assessment, Description, Score, Image, Image2, ID) VALUES ('" &
CategoryCombo.SelectedItem.ToString & "', '" &
ElementCombo.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",arrImae)
command.Parameters.AddWithValue ("@Image2",arrImage2)
reader = command.ExecuteReader

Figure 3.12: Code for inserting data to database.

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,

the code on Figure 3.13 is used in the program.

Dim mstream As New System.IO.MemoryStream

Photo1.Image.Save(mstream,System.Drawing.Imaging.ImageFormat.Jpeg)

Dim arrImage() As Byte = mstream.GetBuffer()


mstream.Close()

Figure 3.13: Code for converting image to binary.

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.

'Delete data from database


Dim query As String
query = "DELETE FROM cspmatrix.defects WHERE No = " & id & ""
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader

Figure 3.14: Code for deleting data from database.

'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

Figure 3.15: Code for updating data to database.

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

first step every time.

Normally, software testing involves the execution of a software component or

system component to evaluate one or more properties of interest. These properties

in return indicate the extent to which the component or system under test will:

i) Meet the requirements that guided its design and development.

ii) Responds correctly to all kinds of inputs.

iii) Performs its functions within an acceptable time.

iv) Sufficiently usable.

v) Can be installed and run in its intended environments.

vi) Achieve the general result its users desire.

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

regression test allows a consistent, repeatable validation of each new release of

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

and resources needed to perform the required testing.

Second type of testing is stress testing. Stress testing is usually conducted to

evaluate a system or component at or beyond the limits of its specified requirements

to determine the load under which it fails and how. In other word, stress testing

refers to a type of testing that is so harsh, it is expected to push the program to

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

application as an example below are ways stress might be introduced.

i) Randomly shut down and restart ports on the network switches/routers that

connect the servers.

ii) Take the database offline, then restart it.

iii) Run a process that consumes resources (CPU, memory, disk, network) on

the Web and database servers.

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

developing and testing in this project has the following specification:

CPU: Intel Core i5-2430M 2.4GHz.

GPU: NVIDIA GeForce GT520M, 1 GB VRAM graphic processor.

RAM: 2 GB DDR3 1333 Mhz.

STORAGE: 500 GB 7200 RPM Hard Disk Drive.

DISPLAY: 14 display with 1366768.

ETC: Pre-installed Microsoft Office 2013, Pre-installed MySQL Sever.

3.3.4 Deployment

Generally, software deployment is the process of getting the developed program

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

procedure of the activity however is hard to be identified as every software system is

unique. Thus, deployment phase should be treated as a baseline that every program

developed has to customize according to specific requirement.

The most important activity in deployment phase is installation. Installation is

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

overall rating of the building can be obtained.

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

result obtained from the analysis.

59
CHAPTER 4

RESULTS AND DISCUSSION

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

from building inspection of lecture halls.

4.2 Developed Application / Software

After testing, The CSP Program, it is ready for deployment and installation. The

installation takes up to 5 to 10 minutes depending on system hardware. The

minimum and recommended requirements for running the program are as follows:

a) Minimum System Requirement:

Operating XP Service Pack 3

Processor: Intel Pentium 2.0Ghz

RAM: 1GB DDR3

HD Space: 100 MB available space

Software: Microsoft Office 2007, MySQL Sever

b) Recommended system requirement:

Operating System: 64-Bit Windows 7 or higher

Processor: Intel Core i3 2.0Ghz or higher

RAM: 2GB DDR3 or higher

60
HD Space: 100 MB available space

Software: Microsoft Office 2007, MySQL Sever

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

delete new building.

Figure 4.1: Splash Screen.

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

information such as; Category, Element, Sub-Element, Condition, Assessment,

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

window. The operation of creating executive summary in a new Microsoft Word

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

clicking Add button.

Figure 4.6: Form 4 (Add Defect Window).

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

textboxes will replace the old information.

Figure 4.7: Form 5 (Edit Defect Window).

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

element or sub-element does not exist in building element database. This is

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

program the flexibility and the

66
Figure 4.8: Form 6 (Element Window).

4.3 Building Rating

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

done at the same time.

4.3.1 Dewan Kuliah Pusat 1 (DKP1), UMS

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

defects were in Dilapidated Condition (Red Color).

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

Drainage Sum pit


Displaced cover. Clogged with 9 2 2 4 E9
leaves.
Wall Paint
10 1 1 1 E10
Mold on the whole wall.

Roof Cover
11 2 2 4 E11
Vegetation growing on roof.

Roof Roof Tile


12 2 2 4 E12
Roof tile came off.

Speaker -
13 5 3 15 E13
Missing speaker unit.

Door Door Closer


14 2 2 6 E14
Door closer fail.

Door Panel
15 2 2 12 E15
Broken Panel on hinge side.

Ceiling Ceiling Panel


16 2 1 2 I1
Ceiling panel displaced.
Interior
Door Door Panel
Door panel and frame slightly 17 2 2 4 I2
damaged.
Light Light Bulb
18 4 3 12 S1
Light not turning on

Seat Back Support


Services 19 4 3 12 S2
Missing back support.

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

Figure 4.9: Location of defect at DKP1, UMS


70
Table 4.2: Number of defects according to category for DKP 1, UMS.
No. of Percentage
No. Category
Defect (%)
1 Exterior 15 75

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.

No. Element No. of Defect Percentage (%)

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

defect each. Based on observation during building inspection conducted, defects

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

steel cover was displaced from its original position.

4.3.2 Dewan Kuliah Awam (DKA), PKK

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

CSP Program. An Executive Summary (Appendix B) was produced showing 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.

Visual Display Screen


The display screen fails to roll 14 3 3 9 S2
upward.
Lights Starter
No lighting in the s Audio-Visual 15 3 3 9 S3
Services Room.
Main Switch
Cover
Box
16 3 4 12 S4
The cover of the switch box is
missing and left opened.
Audio Wiring
17 2 3 6 S5
Cables not sorted properly and the
case is left unattained.

74
S3

E7 S4
E6

S2

E5

I4

S1

E4

I3

DKA
I2 I1

E3
E8 E1
E1

Figure 4.10: Location of defect at DKA, PKK

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

33.33% respectively. The percentage of exterior defect found to be slightly higher

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

improper handling of the equipment.

76
Table 4.6: Number of defects according to building element for DKA, PKK.

No. Element No. of Defect Percentage (%)

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.

A typical crack of buildings in Malaysia is of non-structural type i.e. shrinkage

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

switches and broken starter. In addition to that, downpipe were found to be

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.

Table 4.7: Summary of result for both lecture halls.

Overall
Total No. Of
Building Total Score Building
Marks Defect
Rating

Dewan Kuliah Pusat 1


136 20 7 Fair
(DKP1), UMS.

Dewan Kuliah Awam


89 17 5 Fair
(DKA), PKK.

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

same overall rating which is Fair.

The condition of lecture hall is important as it is related to the educational

performance. This is especially true when factoring message or lecture delivered to

the audience. The condition of lecture hall is related to students performance. As

concluded by Fisher 2011, improved building conditions lead to improved student

performance. Facility for both lecture hall inspected were working in a fair condition.

To maximize the performance of lecture hall, these facilities need to be improved as

it plays an important role to students behavior and performance. Study conducted by

Uline C.L., 2010 showed that physical conditions of the school played a role in

shaping student behavior and performance.

79
CHAPTER 5

CONCLUSION AND RECOMMENDATION

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

hall of educational institution around Kota Kinabalu.

5.2. Conclusion

In chapter 4, the developed computer program is able to be executed and run

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

change in the future.

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

use traditional long hand description method.

Finally, using CSP1 Matrix helped determine current building condition.

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

defect that need serious attention and vice versa.

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

cooperation from the outside agency to be specific, other university in order to

conduct inspection on their lecture hall.

5.3. Recommendation

This study shows great success in development of CSP 1 Program and


assessment of lecture hall. However, there is room for improvement in future study.
The scope of study can be expand by conducting building inspection of lecture
around Sabah, Sarawak or even Peninsular Malaysia. Furthermore, the CSP Program
can be improved by adding new feature or by testing it with other building besides
lecture hall.

81
REFERENCES

Abbott, G. R., McDuling, J. J., Parsons, S. A., & Schoeman, J. C. 2007.Building


condition assessment: a performance evaluation tool towards sustainable asset
management.

ANSI/ASHRAE 55. 2004. Thermal Environmental Conditions for Human Occupancy,


America Society of Heating, Refrigerating and Air-conditioning Engineers Inc.,
Atlanta, USA.

Barman, C. 1984.Slide-Tape Presentations on a Classroom Budget.The American


Biology Teacher, 46(6), 344-346. doi:10.2307/4447864

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.

Fisher, K. 2001. Building Better Outcomes: The Impact of School Infrastructure on


Student Outcomes and Behaviour. Schooling Issues Digest.

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.

Davis, H. 2003. Visual Basic.NET for Windows (Visual QuickStart Guide).Peachpit


Press.

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.

Ekadahl M. V. 2004. Advance Guide to Programming with Microsoft Visual Basic


.NET. Reno: University of Nevada

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.

Kent, J. 2002. Visual Basic .NET: A Beginners Guide. California: Berkely.

Hoppe, H. U., Luther, W., Mhlenbrock, M., Otten, W., &Tewissen, F.


1999.Interactive presentation support for an electronic lecture hall-a practice
report.Advanced Research in Computers and Communications in Education,
923-930.

Jago, E., & Tanner, K. (1999). Influence of the school facility on student
achievement. Dept. of Educational Leadership; University of Georgia.

Lee, J. H., & Aktan, H. M. 1997.Study of building deterioration. In M. Saito (Ed.),


Proceedings of the Speciality Conference on Infrastructure Condition
Assessment: Art, Science, Practice. (pp. 1-10). ASCE.
vvvv
Lee, K. S. 2011. The Noise Reduction through Lecture Halls Wall. Final Year Project,
UTAR.

Lomax, P. 1998. VB & VBA in A Nutshell. California: Sebastopol.

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.

National Centre for Education Statistics (NCES), 2003. Facilities Information


Management: A Guide for State and Local Education, U.S. Department of
Education, NCES 2003-400, U.S.A.

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.

Samani, S. A. 2012. The impact of indoor lighting on students' learning performance


in learning environments: A knowledge internalization
perspective. International Journal of Business and Social Science, 3(24).

Sarman, Mohd, A., Che-ani, & Irfan, A. 2015. Concrete Flat Roof Defects in Equatorial
Climates. International Journal of Applied Engineering Research. 10(3), 36.

Scott M. L. 2009. Programming Language Pragmatics. New York: Rochester

Singh, A. S. 2008. A framework for efficient condition assessment of the building


infrastructure.

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

TechnischeUniversiteitEindhoven.Uzarski, D. R. 2002.Condition assessment manual


for building components for use with BUILDER version 2.1. US Army,
Engineering Research and Development Centre-Construction Engineering
Research Laboratory (ERDC-CERL), Champaign, IL, USA.

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.

Van-Roy, P., &Haridi, S. 2003. Concepts, techniques, and models of computer


programming.MIT press.

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.

Wasilah, J. P., & Rachmawati, M. 2013.Artificial Lighting Design at the Lecture


Theatre of the Faculty of Engineering, Hasanuddin University.

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

Appendix A: Executive Summary for Dewan Kuliah Pusat 1 (DKP1), UMS

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

Public Class mainView


Dim MysqlConn As MySqlConnection
Dim command As MySqlCommand
Dim id As Integer
'New connection funcition
Private Sub New_Connection()
MysqlConn = New MySqlConnection
MysqlConn.ConnectionString = "server=localhost;" _
& "uid=root;" _
& "pwd=password123;" _
& "database=cspmatrix;"
End Sub
'Delete and reset data funcition
Private Sub truncate()
New_Connection()

Dim sda As New MySqlDataAdapter


Dim dbdatatableas As New DataTable
Dim dbsource As New BindingSource
Dim reader As MySqlDataReader

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

Dim sda As New MySqlDataAdapter


Dim dbdatatableas As New DataTable
Dim dbsource As New BindingSource
Dim reader As MySqlDataReader

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

Dim sda As New MySqlDataAdapter


Dim dbdatatableas As New DataTable
Dim dbsource As New BindingSource

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

Dim read As MySqlDataReader


Try
MysqlConn.Open()
Dim query As String
query = "Select * from cspmatrix.building_list WHERE No = '" & BuildingID.Text &
"'"
command = New MySqlCommand(query, MysqlConn)
read = command.ExecuteReader
While read.Read
BuildingID.Text = read.GetInt32("No")
txtBuildingName.Text = read.GetString("Name")
txtAddress.Text = read.GetString("Address")
txtOwner.Text = read.GetString("owner")
InspectionDate.Text = read.GetInt32("Date")
txtWeather.Text = read.GetString("Weather")
End While
MysqlConn.Close()
Catch ex As Exception

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

MessageBox.Show("Please Select a building")

ElseIf 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

itemView = New DefectsList(name, id)


itemView.Show()
Me.Hide()

End If

End Sub
'Delete Building
Private Sub Delete_Click(sender As Object, e As EventArgs) Handles Delete.Click

Call New_Connection()

Dim reader As MySqlDataReader

Try
AlterTable()
MysqlConn.Open()

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

Dim query2 As String


query2 = "DELETE FROM cspmatrix.defects
Where ID = " & id & ""
command = New MySqlCommand(query2, MysqlConn)
reader = command.ExecuteReader
MysqlConn.Close()

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

Dim reader As MySqlDataReader

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

Dim reader As MySqlDataReader

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 &
"'"

command = New MySqlCommand(query, MysqlConn)


reader = command.ExecuteReader

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

Public Class DefectsList


Dim MysqlConn As MySqlConnection
Dim command As MySqlCommand
Dim BuildingName, comment As String
Dim id, green, yellow, red, total, totalScore, totalMark As Integer

Private Sub New_Connection()


MysqlConn = New MySqlConnection
MysqlConn.ConnectionString = "server=localhost;" _
& "uid=root;" _
& "pwd=password123;" _
& "database=cspmatrix;"
End Sub
'Delete and reset data duncition
Private Sub turncate()
New_Connection()

Dim sda As New MySqlDataAdapter


Dim dbdatatableas As New DataTable
Dim dbsource As New BindingSource
Dim reader As MySqlDataReader

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

Dim reader As MySqlDataReader

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

Dim sda As New MySqlDataAdapter


Dim dbdatatableas As New DataTable
Dim dbsource As New BindingSource
96
Try

DataGridView1.RowTemplate.Height = 70
AlterTable()
MysqlConn.Open()

Dim query As String


query = "SELECT No, Category, Elements, `Sub-Element`, Location, `Condition`,
Assessment, Description, Score, Image
FROM cspmatrix.defects WHERE ID = " & id & ""

command = New MySqlCommand(query, MysqlConn)


sda.SelectCommand = command
sda.Fill(dbdatatableas)
dbsource.DataSource = dbdatatableas
DataGridView1.DataSource = dbsource

green = 0
yellow = 0
red = 0
total = 0
totalMark = 0

For i As Integer = 0 To Me.DataGridView1.Rows.Count - 1


If DataGridView1.Rows(i).Cells("Score").Value > 12 Then
DataGridView1.Rows(i).Cells("Score").Style.BackColor = Color.Red
totalMark = totalMark +
Convert.ToInt32(DataGridView1.Rows(i).Cells("Score").Value)
red = red + 1
total = total + 1
ElseIf DataGridView1.Rows(i).Cells("Score").Value > 4 Then
DataGridView1.Rows(i).Cells("Score").Style.BackColor = Color.Yellow
totalMark = totalMark +
Convert.ToInt32(DataGridView1.Rows(i).Cells("Score").Value)
yellow = yellow + 1
total = total + 1
ElseIf DataGridView1.Rows(i).Cells("Score").Value > 0 Then
DataGridView1.Rows(i).Cells("Score").Style.BackColor = Color.Green
totalMark = totalMark +
Convert.ToInt32(DataGridView1.Rows(i).Cells("Score").Value)
green = green + 1
total = total + 1
End If
Next

sda.Update(dbdatatableas)

DataGridView1.Refresh()

MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

'DataGridView1.Columns("Image").Width = 100

For i As Integer = 0 To DataGridView1.Columns.Count - 1


If TypeOf DataGridView1.Columns(i) Is DataGridViewImageColumn Then
DirectCast(DataGridView1.Columns(i), DataGridViewImageColumn).ImageLayout =
DataGridViewImageCellLayout.Zoom
End If
Next
End Sub

Public Sub New(ByVal name1 As String, ByVal id1 As Integer)

' This call is required by the designer.

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

Dim reader As MySqlDataReader

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

query = "DELETE FROM cspmatrix.defects


WHERE No = " & id & ""
command = New MySqlCommand(query, MysqlConn)

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

Dim element, subelement, category, name, condition, assessment As String

If selectedRowCount = 0 Then

MessageBox.Show("Please Select a defect to edit")

ElseIf 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

itemView = New EditDefect(element, subelement, category, condition, assessment,


BuildingName, ide, id)
itemView.Show()
Me.Hide()

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

Dim element, subelement, category, name, condition, assessment, score As String

If selectedRowCount = 0 Then

MessageBox.Show("Please Select a defect to view")

ElseIf 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

itemView = New Defect_Details(element, subelement, category, condition,


assessment, BuildingName, ide, id)
itemView.Show()

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

Public Class NewDefect


Dim BuildingName As String
Dim id As Integer
Dim MysqlConn As MySqlConnection
Dim command As New MySqlCommand
Dim command2 As New MySqlCommand
Dim path, safe As String

100
Public Sub New(ByVal Name1 As String, ByVal ID1 As Integer)

' This call is required by the designer.

InitializeComponent()

' Add any initialization after the InitializeComponent() call.

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

Dim sda As New MySqlDataAdapter


Dim dbdatatableas As New DataTable
Dim dbsource As New BindingSource
Dim reader As MySqlDataReader

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

Dim reader As MySqlDataReader

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

Dim reader As MySqlDataReader

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

'Show Sub-Elemet if Certain Element is selected


Private Sub ElementCombo_SelectedIndexChanged(sender As Object, e As
EventArgs) Handles ElementCombo.SelectedIndexChanged

102
Call New_Connection()

Dim reader As MySqlDataReader

Try
MysqlConn.Open()

Dim query As String


query = "SELECT * FROM cspmatrix.`sub-element` WHERE Element ='" &
ElementCombo.Text & "'"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
subelementCombo.Items.Clear()

While reader.Read

Dim sName = reader.GetString("Sub-Element")


subelementCombo.Items.Add(sName)

End While

MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End Sub

'Add new Element Form


Private Sub AddNewElementToolStripMenuItem_Click(sender As Object, e As
EventArgs) Handles AddNewElementToolStripMenuItem.Click
Dim newelement As EditElement
newelement = New EditElement()
newelement.Show()

End Sub

'Open File Browser


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

' Dim pdffile As String =


IO.Path.Combine(My.Application.Info.DirectoryPath, safe)
'MessageBox.Show(pdffile)
End Sub
'Open File Browser 2
Private Sub Browse2_Click(sender As Object, e As EventArgs) Handles
Browse2.Click
Dim OpenFileDialog2 As New OpenFileDialog
OpenFileDialog2.Filter = "Image Files (*)|*.jpg; *.png; *.bmp; *.gif"
103
If OpenFileDialog2.ShowDialog = System.Windows.Forms.DialogResult.OK
Then
path = OpenFileDialog2.FileName
safe = OpenFileDialog2.SafeFileName
Photo2.Image = Image.FromFile(path)
End If

'Dim pdffile As String =


IO.Path.Combine(My.Application.Info.DirectoryPath, safe)
'MessageBox.Show(pdffile)
End Sub
'Start Saving
Private Sub Save_Click(sender As Object, e As EventArgs) Handles Save.Click

'Connect to Database
Call New_Connection()

Dim reader As MySqlDataReader

Try
AlterTable()
MysqlConn.Open()

'Score of Element
Dim condition As Integer
Dim assessment As Integer
Dim score As Integer

If ConditionCombo.Text = "Good" Then


condition = 1
ElseIf ConditionCombo.Text = "Fair" Then
condition = 2
ElseIf ConditionCombo.Text = "Poor" Then
condition = 3
ElseIf ConditionCombo.Text = "Very Poor" Then
condition = 4
ElseIf ConditionCombo.Text = "Dilapidated" Then
condition = 5
End If

If AssessmentCombo.Text = "Normal" Then


assessment = 1
ElseIf AssessmentCombo.Text = "Routine" Then
assessment = 2
ElseIf AssessmentCombo.Text = "Urgent" Then
assessment = 3
ElseIf AssessmentCombo.Text = "Emergency" Then
assessment = 4
End If

score = condition * assessment

'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

MessageBox.Show("New Defect Successfully Added")

MysqlConn.Close()
Me.Close()

Dim item As DefectsList


item = New DefectsList(BuildingName, id)
item.Show()

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

Public Class EditDefect


Dim BuildingName As String
Dim id, rid As Integer
Dim MysqlConn As MySqlConnection
Dim command As New MySqlCommand
Dim element, subelement, category, condition, assessment, name, path, real, safe As String

'New MySql Connection


Private Sub New_Connection()
MysqlConn = New MySqlConnection
MysqlConn.ConnectionString = "server=localhost;" _
& "uid=root;" _
& "pwd=password123;" _
& "database=cspmatrix;"
End Sub

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)

' This call is required by the designer.

InitializeComponent()

' Add any initialization after the InitializeComponent() call.

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

Dim reader As MySqlDataReader

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

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


CategoryCombo.SelectedIndexChanged
'Show Elemets if Certain Category is selected
Call New_Connection()

Dim reader As MySqlDataReader

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

'Show Sub-Elemet if Certain Element is selected


Private Sub ElementCombo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles
ElementCombo.SelectedIndexChanged

Call New_Connection()

Dim reader As MySqlDataReader

Try
MysqlConn.Open()

Dim query As String


query = "SELECT * FROM cspmatrix.`sub-element` WHERE Element ='" &
ElementCombo.Text & "'"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
subelementCombo.Items.Clear()

While reader.Read

Dim sName = reader.GetString("Sub-Element")


subelementCombo.Items.Add(sName)

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

Dim sda As New MySqlDataAdapter

Try
MysqlConn.Open()
Dim query As String
Dim da As New MySqlDataAdapter
Dim dr As MySqlDataReader
Dim ds, ds1 As New DataSet

query = "SELECT Description, Location, Image, Image2


FROM cspmatrix.defects WHERE No = " & id & ""
command = New MySqlCommand(query, MysqlConn)
da = New MySqlDataAdapter(command)
da.Fill(ds, "Subject_Detail")
txtDescription.Text = ds.Tables(0).Rows(0).Item(0)
txtName.Text = ds.Tables(0).Rows(0).Item(1)

Dim img() As Byte


Dim img2() As Byte
107
img = ds.Tables(0).Rows(0).Item(2)
Dim ms As New MemoryStream(img)
Photo1.Image = Image.FromStream(ms)

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

' Dim pdffile As String = IO.Path.Combine(My.Application.Info.DirectoryPath, safe)


' MessageBox.Show(pdffile)
End Sub
'Browse photo 2
Private Sub Browse2_Click(sender As Object, e As EventArgs) Handles Browse2.Click
Dim OpenFileDialog2 As New OpenFileDialog
OpenFileDialog2.Filter = "Image Files (*)|*.jpg; *.png; *.bmp; *.gif"
If OpenFileDialog2.ShowDialog = System.Windows.Forms.DialogResult.OK Then
path = OpenFileDialog2.FileName
safe = OpenFileDialog2.SafeFileName
Photo2.Image = Image.FromFile(path)
End If

' Dim pdffile As String = IO.Path.Combine(My.Application.Info.DirectoryPath, safe)


'MessageBox.Show(pdffile)
End Sub

Private Sub Save_Click(sender As Object, e As EventArgs) Handles Save.Click


'Connect to Database
Call New_Connection()

Dim reader As MySqlDataReader

Try
MysqlConn.Open()

'Score of Element
Dim condition As Integer
Dim assessment As Integer
Dim score As Integer

If ConditionCombo.Text = "Good" Then


condition = 1
ElseIf ConditionCombo.Text = "Fair" Then
condition = 2
ElseIf ConditionCombo.Text = "Poor" Then
condition = 3
ElseIf ConditionCombo.Text = "Very Poor" Then
condition = 4
ElseIf ConditionCombo.Text = "Dilapidated" Then
condition = 5
End If

If AssessmentCombo.Text = "Normal" Then


assessment = 1

108
ElseIf AssessmentCombo.Text = "Routine" Then
assessment = 2
ElseIf AssessmentCombo.Text = "Urgent" Then
assessment = 3
ElseIf AssessmentCombo.Text = "Emergency" Then
assessment = 4
End If

score = condition * assessment

'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 & "'"

command = New MySqlCommand(query, MysqlConn)


command.Parameters.AddWithValue("@Image", arrImage)
command.Parameters.AddWithValue("@Image2", arrImage2)
reader = command.ExecuteReader

MessageBox.Show("Defect Successfully Updated")

MysqlConn.Close()
Me.Close()

Dim item As DefectsList


item = New DefectsList(name, rid)
item.Show()

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 Class Defect_Details

Dim BuildingName As String


Dim id, rid As Integer
Dim MysqlConn As MySqlConnection
Dim command As New MySqlCommand
Dim element, subelement, category, condition, assessment, name, path, real, pic, safe,
score As String
'New MySql Connection
Private Sub New_Connection()
MysqlConn = New MySqlConnection
MysqlConn.ConnectionString = "server=localhost;" _
& "uid=root;" _
& "pwd=password123;" _
& "database=cspmatrix;"
End Sub

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)

' This call is required by the designer.

InitializeComponent()

' Add any initialization after the InitializeComponent() call.

category = cate
element = ele
subelement = subele
name = name1
condition = condi
assessment = assess
rid = realId
id = id1

End Sub

Private Sub Scorecolor()

If labelScore.Text > 14 Then


labelScore.BackColor = Color.Red
ElseIf labelScore.Text > 4 Then
labelScore.BackColor = Color.Yellow
ElseIf labelScore.Text > 0 Then
labelScore.BackColor = Color.Green

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

Dim sda As New MySqlDataAdapter

Try
MysqlConn.Open()

110
Dim query As String
Dim da As New MySqlDataAdapter
Dim dr As MySqlDataReader
Dim ds, ds1 As New DataSet

query = "SELECT Description, Location , Score, Image, Image2


FROM cspmatrix.defects WHERE No = " & id & ""
command = New MySqlCommand(query, MysqlConn)
da = New MySqlDataAdapter(command)
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)

Dim img() As Byte


Dim img2() As Byte

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

Private Sub CloseIt_Click(sender As Object, e As EventArgs) Handles CloseIt.Click


Me.Close()

End Sub

End Class

Element/Subelement Edit
Imports MySql.Data.MySqlClient
Imports System.IO

Public Class EditElement


Dim MysqlConn As MySqlConnection
Dim command As MySqlCommand
Dim BuildingName As String
Dim id As Integer
'New Connection
Private Sub New_Connection()
MysqlConn = New MySqlConnection
MysqlConn.ConnectionString = "server=localhost;" _
& "uid=root;" _
& "pwd=password123;" _
& "database=cspmatrix;"
End Sub

Private Sub populate_category()


Call New_Connection()

Dim reader As MySqlDataReader

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

Private Sub Populate_element()

Call New_Connection()

Dim reader As MySqlDataReader

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

Dim reader As MySqlDataReader

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

Dim reader As MySqlDataReader

Try
MysqlConn.Open()

Dim query As String


query = "SELECT * FROM cspmatrix.`sub-element` WHERE Element ='" &
ElementCombo2.Text & "'"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader
SubelementCombo.Items.Clear()
subelementEdit.Clear()

While reader.Read

Dim sName = reader.GetString("Sub-Element")


SubelementCombo.Items.Add(sName)

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

Dim reader As MySqlDataReader

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

Dim reader As MySqlDataReader

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

Dim reader As MySqlDataReader

Try
MysqlConn.Open()

Dim query As String


query = "INSERT INTO cspmatrix.category
(Category)
VALUES ('" & Editcat.Text & "')"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader

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

Dim reader As MySqlDataReader

Try
MysqlConn.Open()

Dim query As String


query = "UPDATE cspmatrix.category
Set Category ='" & Editcat.Text & "'
WHERE No = '" & CategoryID.Text & "'"

command = New MySqlCommand(query, MysqlConn)


reader = command.ExecuteReader

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

Dim reader As MySqlDataReader

Try
MysqlConn.Open()

Dim query As String


query = "DELETE FROM cspmatrix.category WHERE Category = " & Editcat.Text & ""

command = New MySqlCommand(query, MysqlConn)


reader = command.ExecuteReader

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

'Save New Element


Private Sub elementSave_Click(sender As Object, e As EventArgs) Handles elementSave.Click
Call New_Connection()

Dim reader As MySqlDataReader

Try
MysqlConn.Open()

Dim query As String


query = "INSERT INTO cspmatrix.elements
(Category, Element)
VALUES ('" & CategoryCombo.SelectedItem.ToString & "', '" &
elementEdit.Text & "')"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader

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

'Update existing element


Private Sub elementUpdate_Click(sender As Object, e As EventArgs) Handles
elementUpdate.Click
Call New_Connection()
Dim reader As MySqlDataReader

Try
MysqlConn.Open()
Dim query As String
query = "UPDATE cspmatrix.elements
Set Category ='" & CategoryCombo.SelectedItem.ToString & "', Element ='" &
elementEdit.Text & "'
WHERE No = '" & ElementID.Text & "'"

command = New MySqlCommand(query, MysqlConn)


reader = command.ExecuteReader

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

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


elementDelete.Click
Call New_Connection()
Dim reader As MySqlDataReader

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

'Populate Element combo on Tab3


Private Sub CategoryCombo2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles
CategoryCombo2.SelectedIndexChanged
Populate_element_Tab2()
End Sub
'Show Sub Element in Combo on Tab3
Private Sub ElementCombo2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles
ElementCombo2.SelectedIndexChanged
Populate_SubElement_Tab2()
End Sub
'Show Sub-element combo in edit in Tab 3
Private Sub SubelementCombo_SelectedIndexChanged_1(sender As Object, e As EventArgs)
Handles SubelementCombo.SelectedIndexChanged
Call New_Connection()
117
Dim reader As MySqlDataReader

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

Dim query As String


query = "INSERT INTO cspmatrix.`sub-element`
(Element, `Sub-Element`)
VALUES ('" & ElementCombo2.SelectedItem.ToString & "', '" &
subelementEdit.Text & "')"
command = New MySqlCommand(query, MysqlConn)
reader = command.ExecuteReader

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 & "'"

command = New MySqlCommand(query, MysqlConn)


reader = command.ExecuteReader

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 Class PrintPreview

Dim MysqlConn As MySqlConnection


Dim command As MySqlCommand
Dim buildingName, comment, text, fair As String
Dim id, green, yellow, red, total, totalScore, totalMark As Integer

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)

' This call is required by the designer.

InitializeComponent()

' Add any initialization after the InitializeComponent() call.


green = good
yellow = medium
red = bad
total = total1
totalScore = totalscore1
totalMark = totalmark1
comment = comm
buildingName = name1
id = id1

End Sub

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


Dim buildingname, weather, date1, ownername, address As String
MysqlConn = New MySqlConnection
MysqlConn.ConnectionString = "server=localhost;" _
& "uid=root;" _
& "pwd=password123;" _
& "database=cspmatrix;"

Dim sda As New MySqlDataAdapter

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

Dim oWord As Word.Application


Dim oDoc As Word.Document
Dim oTable, oTable2 As Word.Table
Dim oPara1 As Word.Paragraph, oPara2 As Word.Paragraph
Dim oPara3 As Word.Paragraph, oPara4 As Word.Paragraph
Dim oPara5 As Word.Paragraph
Dim oRng As Word.Range
Dim oShape As Word.InlineShape
Dim oChart As Object
Dim Pos As Double

'Start Word and open the document template.


oWord = CreateObject("Word.Application")
oWord.Visible = True
oDoc = oWord.Documents.Add

'Insert a paragraph at the beginning of the document.


oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "Building Condition Survey For"
oPara1.Range.Font.Bold = True
oPara1.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
oPara1.Format.SpaceAfter = 5 '24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter()

'Insert a paragraph at the beginning of the document.


oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = buildingname
oPara1.Range.Font.Bold = True
oPara1.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
oPara1.Format.SpaceAfter = 10 '24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter()

'Insert a paragraph at the beginning of the document.


oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "Condition Survey Protocol (CSP) 1"
oPara1.Range.Font.Bold = True
oPara1.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
oPara1.Format.SpaceAfter = 10 '24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter()

'Insert a paragraph at the beginning of the document.


oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "EXECUTIVE SUMMARY"
oPara1.Range.Font.Bold = True
oPara1.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
oPara1.Format.SpaceAfter = 3 '24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter()

'Insert a paragraph at the beginning of the document.


oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text =
"__________________________________________________________________________________"
oPara1.Range.Font.Bold = True
oPara1.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft
oPara1.Format.SpaceAfter = 5 '24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter()

'Insert a paragraph at the beginning of the document.


oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "1.0. Property Information"
oPara1.Range.Font.Bold = True
oPara1.Format.SpaceAfter = 10 '24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter()

'Insert a paragraph at the beginning of the document.


oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "Building Address : " + address
oPara1.Range.Font.Bold = True
oPara1.Format.SpaceAfter = 0 '24 pt spacing after paragraph.
121
oPara1.Range.InsertParagraphAfter()

'Insert a paragraph at the beginning of the document.


oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "Owner Name : " + ownername
oPara1.Range.Font.Bold = True
oPara1.Format.SpaceAfter = 0 '24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter()

'Insert a paragraph at the beginning of the document.


oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "Date of Inspection : " + date1
oPara1.Range.Font.Bold = True
oPara1.Format.SpaceAfter = 0 '24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter()

'Insert a paragraph at the beginning of the document.


oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "Weather : " + weather
oPara1.Range.Font.Bold = True
oPara1.Format.SpaceAfter = 10 '24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter()

'Insert a paragraph at the end of the document.


'** \endofdoc is a predefined bookmark.
oPara2 = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks.Item("\endofdoc").Range)
oPara2.Range.Text = "2.0. Condition Survey Protocol (CSP) 1 Matrix"
oPara2.Format.SpaceAfter = 5

'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.Text = text


If (text = "Green") Then
oTable.Cell(r, c).Shading.BackgroundPatternColor =
Word.WdColor.wdColorGreen
ElseIf (text = "Yellow") Then
oTable.Cell(r, c).Shading.BackgroundPatternColor =
Word.WdColor.wdColorYellow
ElseIf (text = "Red") Then
oTable.Cell(r, c).Shading.BackgroundPatternColor = Word.WdColor.wdColorRed
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 paragraph at the end of the document.


'** \endofdoc is a predefined bookmark.
oPara3 = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks.Item("\endofdoc").Range)
oPara3.Range.InsertParagraphBefore()
oPara3.Range.Text = "3.0 Overall Building Rating"
oPara3.Format.SpaceAfter = 5

'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

ElseIf (rw = 2) Then

If (clm = 1) Then
text = "1."
ElseIf (clm = 2) Then
text = "Good"
ElseIf (clm = 3) Then
text = "1 to 4"
End If

ElseIf (rw = 3) Then

If (clm = 1) Then
text = "2."
ElseIf (clm = 2) Then
text = "Fair"
ElseIf (clm = 3) Then
text = "5 to 12"
End If

ElseIf (rw = 4) Then

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.Cell(rw, clm).Range.Text = text


oTable2.Cell(rw, clm).Range.Borders(Word.WdBorderType.wdBorderLeft).LineStyle
= Word.WdLineStyle.wdLineStyleSingle
oTable2.Cell(rw, clm).Range.Borders(Word.WdBorderType.wdBorderRight).LineStyle
= Word.WdLineStyle.wdLineStyleSingle
oTable2.Cell(rw, clm).Range.Borders(Word.WdBorderType.wdBorderTop).LineStyle =
Word.WdLineStyle.wdLineStyleSingle
oTable2.Cell(rw,
clm).Range.Borders(Word.WdBorderType.wdBorderBottom).LineStyle =
Word.WdLineStyle.wdLineStyleSingle

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

If (comment = "Good") Then


text = "This building is in Good condition.
However, the score is " & totalScore & ", indicating that, if the defects identified in this
inspection, especially the ones coded 5 to 12, are left unattended, the building's condition
will fall to fair.
Therefore, it is recommended that periodical inspections be carried out on this building and
that any actions recommended by this report are carried out to prevent further dilapidation of
the building."
ElseIf (comment = "Fair") Then
text = "This building is in Fair condition.
However, the score is " & totalScore & ", indicating that, if the defects identified in this
inspection, especially the ones coded 13 to 20, are left unattended, the building's condition
will fall to dilapidated.
Therefore, it is recommended that periodical inspections be carried out on this building and
that any actions recommended by this report are carried out to prevent further dilapidation of
the building."
ElseIf (comment = "Dilapidated") Then
text = "This building is in Dilapidated.
However, the score is " & totalScore & ", indicating that, if the defects identified in this
inspection, especially the ones coded 13 to 20, are left unattended, the building's condition
will not be usable.
Therefore, it is recommended that periodical inspections be carried out on this building and
that any actions recommended by this report are carried out to prevent further dilapidation of
the building."
End If
'Insert another paragraph.
oPara3 = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks.Item("\endofdoc").Range)
oPara3.Range.Font.Bold = False
oPara3.Range.Text = text
oPara1.Alignment = Word.WdParagraphAlignment.wdAlignParagraphJustify
oPara3.Format.SpaceAfter = 0

Me.Close()
End Sub
End Class

125

You might also like