Top Banner
TABLE OF CONTENTS Sections Page numbers 1. Introduction…………………………………………………………………………3 2. User requirements………………………………………….……………………3-4 3. Defining database for the system………………………………………………...4 4. System flow diagram of MVS advertisement system………………. ……….5- 6 5.1 Login Form………………………………………………………………6- 8 5.2 Password Registration Form…………………………………………8- 11 5.3 Customer Form……………….………………………………………11- 15 5.4 Advert Form…………………….…………………………..…………16- 20 5.5 Payment Form………………………………………..………………21- 20 5.6 Staff Form………………………………….…………………….……24- 28 5.7 Complains Form………………………………..……………..…...…29- 30 6 System Setup and User Manual……………………………………..….…..32- 33 7 My Role in the Visual Application…………………………………………….....33 8 Conclusion………………………………………………………………………….34 9 References……………………………………………………...………………….35 10 Appendix…………………………………………………………………..……36-42 11 Source and Executable codes of the different forms……………...………42- 75 LIST OF TABLES 1
94
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: SD1046

TABLE OF CONTENTS

Sections Page numbers

1. Introduction…………………………………………………………………………3

2. User requirements………………………………………….……………………3-4

3. Defining database for the system………………………………………………...4

4. System flow diagram of MVS advertisement system……………….……….5- 6

5.1 Login Form………………………………………………………………6- 8

5.2 Password Registration Form…………………………………………8- 11

5.3 Customer Form……………….………………………………………11- 15

5.4 Advert Form…………………….…………………………..…………16- 20

5.5 Payment Form………………………………………..………………21- 20

5.6 Staff Form………………………………….…………………….……24- 28

5.7 Complains Form………………………………..……………..…...…29- 30

6 System Setup and User Manual……………………………………..….…..32-

33

7 My Role in the Visual

Application…………………………………………….....33

8

Conclusion………………………………………………………………………….34

9 References……………………………………………………...

………………….35

10 Appendix…………………………………………………………………..……36-42

11 Source and Executable codes of the different forms……………...………42- 75

LIST OF TABLES

1. Table 3.1: Forms and their corresponding tables in the system’s database............4

2. Table 5.1.1 Objects and properties of the Login form………………………………...7

3. Table 5.1.2 Event Procedures of login Form…………………………………………..7

4. Table 5.2.1: Objects and Properties of the Password Registration Form…………..9

5. Table 5.2.2: Event procedures of the Password Registration form………………….9

1

Page 2: SD1046

6. Table 5.3.1: Object and Properties of the customer form………………………13- 14

7. Table 5.3.2: Event procedures of the customer form………………..………………14

8. Table 5.4.1 Objects and properties of the Advert form……………………………...17

9. Table 5.4.2 Event procedures of the Advert form…………………………...............18

10. Table 5.5.1 Objects and properties of the payment form………………………….22

11. Table 5.5.2 Event procedures of the payment form………………………………..23

12. Table 5.6.1 Objects and properties of the Staff form………………………………26

13. Table 5.6.2 Event procedures of the staff form………………………………..……27

14. Table 5.7.1 Objects and properties of the complain form………………………….30

15. Table 5.7.2 Event procedures of the complain form…………………….…………31

LIST OF FIGURES

1. Figure 4.1: Organization chart of MVS advertisement system…………………………...…5

2. Figure 5.1.1: Sketch of the Login form in MVS advertisement recording System……….....6

3. Figure 5.1.2: Screen shot of the login form……………………………………………………...8

4. Figure 5.2.1: Sketch of the Password registration form in MVS advertisement recording

System……………………………………………………………………….………8

5. Figure 5.2.2: Screen shot of the Password registration form………………………………..10

6. Figure 5.3.1: Sketch of the Customer form in MVS advertisement recording System……12

7. Figure 5.3.2: Screen shot of the customer form………………………………………………15

8. Figure 5.4.1: Sketch of the Advert form in MVS advertisement recording System……….16

9. Figure 5.4.2: Screen shot of the Advert form………………………………………………….19

10. Figure 5.5.1: Sketch of the payment form in MVS advertisement recording System…….21

11. Figure 5.5.2: Screen shot of the payment form……………………………………………….23

12. Figure 5.6.1: Sketch of the staff form in MVS advertisement recording System………….25

13. Figure 5.6.2: Screen shot of the staff form………………………………………………...….28

14. Figure 5.7.1: Sketch of the complain form in MVS advertisement recording System…….29

15. Figure 5.7.2: Screen shot of the complain form………………………………………………32

2

Page 3: SD1046

1 INTRODUCTION

New generation companies are all making frantic efforts to digitalize

their business following the pragmatic development experienced in the I.T

industry. Computer technology has done a lot to the world we live; as it has

made a lot of things easily accessible. These developments are been

welcomed and applied in nearly (if not all) sectors of the economy by the

government and even private agencies.

A sector that cannot do without IT technology is Entertainment, under

which there are broadcasting organizations. It would be practically inevitable

for an advertisement or a broadcasting house to do without IT technology. I

believe this is the major factor that has prompted MVS to change from its

former “spreadsheet” system of recording advert details to a more reliable

computer based system.

We treasure this decision by the new management of MVS and the

confident they have in me, to help in building this new reliable computer

based system. Hence, this project is all about the new system we have

developed for MVS to erase the former flaws of the old system. This system

will help ensure that customer adverts are on air at the right time and region

as entered into the system and also calculate bills and fees for the company.

Based on the Scenario released by MVS we have highlighted the following

user requirements.

2. USER REQUIREMENTS

The system should be able to record the time that an advert should

appear.

The date on which the customer wants the advert to appear should

also be recorded in the system and the system should be able to

record this date.

3

Page 4: SD1046

The system should also be able to record if payment has been made

before the advert appears or if it was or should be made after the

advert is broadcasted.

The system should also be able to record which customer placed a

particular type of advert and be able to record the different types of

adverts that are placed in the channel

The system should also be able to record when an advert has not

appeared at the customer’s deserved date.

More importantly, the system should be able to calculate the amount

that is payable to the TV channel, with the ability of calculating a 10%

fee charged to individual customers and an 8% fee charged to

advertising agencies as profit for MVS Malaysia.

Following these aforementioned requirements we have built the system

to meet these needs and further enhanced it to perform optimally. These and

more shall be explained in this documentation.

3. DEFINING THE DATABASE FOR THIS SYSTEM

The system will have a database comprising of six (6) tables namely:

Customer, staff, Advert, payment, complains, and login tables. Each and

every one of these tables will be connected to the corresponding forms in this

system with codes to enable a user Save, Search, Update, and Delete and

view a particular table of the database in its Grid view with the records that

has been saved by user. For security reasons the database in grid view will

be a read only document. Table 3.1 below are the forms and the

corresponding table to which their records will be saved to in the database.

Forms Corresponding tables in the database

Customer form Customer table

Advert form Advert table

Payment form Payment table

Complains form Complains table

Staff Staff_ table

Password registration form MYV table

Table 3.1: Forms and their corresponding tables in the system’s database

4

Page 5: SD1046

Login Form Password Registration

Splash screen

MDI Form

Staff FormComplain form Customer form

Advert Form

Payment Form

4. SYSTEM FLOW DIAGRAM OF MVS ADVERTISEMENT SYSTEM

Fig.1 shows the organization chart of the system, it diagrammatically

describes how the forms in the system are linked and how user can easily

navigate from one form to another without difficulty. When the system is run

the splash screen appears after which the ‘login form’ shows up, if user has

registered a password earlier; then he would just login to use the system else,

he has to register anew password with the system by clicking the new user

button which takes him to the password registration form. When the password

is registered successfully, user is taken back to the login form in order to log

into the system.

Fig 4.1: Organization chart of MVS advertisement system

After login, the parent form in the system from which you can navigate

to the different forms within the system is opened. The user has to make a

5

Page 6: SD1046

LOGOPICTUREBOX 1

TEXTBOX 1

TEXTBOX 2

USERNAMELABLE

BUTTON 1

PASSWORDLABEL

OK CANCEL

choice of the form he wants to open by clicking on ‘File > Open’ in the menu

bar and choose which form you want to open or alternatively click on any of

the button on the top right corner of the form close to the minimize window

sign.

5.1 LOGIN FORM

Figure 1.0 below, is the user verification form (Login form), this is the

first form that will be seen when you lunch the system for use. You have to

login to be able to use the system hence a password and Username

registration form is provided to enable user register a password of choice.

FIG 5.1.1: Sketch of the Login form in MVS advertisement recording System.

Table 5.1.1 below is the properties table of the login form describing

default system properties that where changed in other to suit the purpose of

the system.

6

Page 7: SD1046

OBJECT NAME TEXTBACKCOLOUR

FONT SIZESize mode

Login form1 Login formActiveCaption

LABEL

Usernamelabel

&username 10 220,23

Passwordlabel

&Password 10 220,23

TEXTBOXTextbox1 10 220,20Textbox2 10 220,20

BUTTON

OK &OK 94,23

Cancel &Cancel 94,23

Button1 New User 94,23

logoPICTUREBOX 165,193 Stretch image

Table 5.1.1 Objects and properties of the Login form.

All the buttons in the Login form have different functions in controlling

the behaviour of the current form; the table below (Table 5.1.2) briefly

describes the functions of the different buttons, otherwise known as the event

procedures.

PROCEDURE ACTION-PSEUDOCODE

OK_Click Registers a valid user to the system

Cancel_Click Cancels the action of login

Button1_ClickEnables a new user to register password and User name.

Table 5.1.2 Event Procedures of login Form

Figure 5.1.2 below is the screen shot of the Login form as designed in

the system. In other to ensure optimal security, the login form has been

programmed to accept password between the ranges of 6–15 characters. Any

password or username that is not up to 6 characters or more than 15

characters cannot be used to login. The symbol beside the password field

also gives this warning when the mouse touches it. To register a new

password click on the New User button and the password registration form

will be opened for you to register a password of your choice.

7

Page 8: SD1046

LOGOPICTUREBOX

USERNAMETEXTBOX

PASSWORDTEXTBOX

TEXTBOX 1

OK BUTTON

LABEL 1

PASSWORDLABEL

USERNAMELABEL

BACK BUTTON

Fig

5.1.2: Screen shot of the login form

5.2 PASSWORD REGISTRATION FORM

Figure 5.2.1 below, is the sketch of the password registration form, it

enables a new user register a password and username in other to use the

advertisement recording system.

Below Figure 5.2.1 is Table 5.2.1, the objects and properties table of

this form as was set in the GUI.

Fig

5.2.1: Sketch of the Password registration form in MVS advert recording System

OBJECT NAME TEXTBACKCOLOR

FONT SIZESizemode

LOGINFORM Loginform2 Password Active

8

Page 9: SD1046

2 Registration Caption

LABEL

Usernamelabel

&username 10 64,23

Passwordlabel

&Password 10 64,23

Label1Confirm Password

10 90,13

TEXTBOX

Usernametextbox

10 180,20

Passwordtextbox

10 180,20

Textbox1 10 180,20

BUTTONSOK &OK 91,23

Cancel &Cancel 91,23 Strechimage

PICTUREBOX

Logo picturebox

165,193

Table 5.2.1: Objects and Properties of the Password Registration Form

The functionality of this form depends upon the codes written

underneath the objects and as such the event procedures (how the buttons

and other objects react when they are called to play) of the form are shown in

Table 5.2.2 below.

PROCEDURE ACTION-PSEUDOCODE

OK_Click Checks the form to make sure no field is empty. Checks that confirm password field matches the password field and save this password to the database

Cancel_Click Cancels the action of login

TextBox1_TextChangedChecks the Password textbox to make sure the password to be registered is between 6- 15 character

Table 5.2.2: Event procedures of the Password Registration form

Figure 5.2.2 below is the screen shot of the password registration form

in MVS advert recording system. The Password registration form enables you

9

Page 10: SD1046

register a new username and password that will log you into the system. This

form can be accessed by clicking the “New user’ button in the Login form.

Registering a password that is below 6 characters generates window shown

in Figure 5.2.2.1 while a password that is more than 15 characters generates

Figure 5.2.2.2 The password and username are case sensitive; hence if

your confirmation does not match the password, you will notice that the ok

button is automatically disabled.

Fig 5.2.2.: Screen Shot of Password registration form

Fig 5.2.2.1: Error message for registering a password that is below 6 characters.

10

Page 11: SD1046

Fig 5.2.2.2: Error message for registering a password that is above 15 characters.

5.3 CUSTOMER FORM

11

Page 12: SD1046

PICTURE BOX 1

LABEL 10

LABEL 9

LABEL 3

TEXTBOX 1

DATETIMEPICKER 1

TEXTBOX 2

TEXTBOX 3

TEXTBOX 4

TEXTBOX 5

RICHTEXTBOX 1

MASKEDTEXTBOX 1

COMBOBOX 4

TEXTBOX 6

COMBOBOX 1

COMBOBOX 2

BUTTON 5

BUTTON 7

BUTTON 6

BUTTON 1

BUTTON 2 BUTTON 4BUTTON 3

LABEL 2

LABEL 14

LABEL 6

LABEL 16

LABEL 5

LABEL 13

LABEL 4

LABEL 7

LABEL 11

LABEL 8

LABEL 15

GROUPBOX 1

GROUPBOX 2

MENU BAR

NumericUpdown 1

Fig 5.3.1: Sketch of the customer form in MVS advertisement recording system.

The figure above is a sketch of the customer form in the MVS

advertisement recording system. Its main function in this program is to gather

and save to the customer table in the database the basic information about

any customer that wishes to place an advert on the channel. It holds details

like customer name, email, Home address, the date of visit, phone number

etc.

12

Page 13: SD1046

In the design of the customer form there where object properties that

where changed in other for the form to meet its required standard and function

optimally. These objects are shown below in Table 5.3.1 with the

corresponding change in properties that was made.

OBJECT NAME TEXTBACKCOLOUR

FORECOLOR

FONT SIZEDROPDOWNNSTYLE

Customer Details

Form 3 Customer FormActive caption

LABELS

Label 10Multi Vision Services Malaysia

Linen 14 364,24

Label 9No 2, Jalan Kempumg, Nilai Malaysia

Blue 9 256,15

Label14Customer Details

12 75,18

Label2 First Name 10 91,18

Label3 Middle Name 10 75,18

Label4 Last Name 10 44,18Label13 Email 10 61,18Label5 Address 10 69,18Label16 Received 10 75,18Label6 Phone 10 82,18Label7 Date of birth 10 73,18

Label11 Nationality 10 75,18

TEXTBOX

Textbox1 239,22Textbox2 239,22Textbox3 239,22Textbox4 239,22Textbox5 100,20Textbox6 239,20

BUTTONS

Button5 Search 75,24Button6 Delete 75,24Button7 Update 75,24Button1 View Database 63,27Button2 Clear 75,23Button3 Next 75,23Button4 Save 75,23

COMBOBOX

Combobo2 137,21

Combobo4 170,23

Combobo1 101,26Drop downList

MaskedTextbox

MaskedTextbox1

239,20

13

Page 14: SD1046

GROUPBOX

Groupbox1 Sex 122,59

Table 5.3.1: Object and Properties of the customer form

After the design of the customer form, codes where written under most

of the objects listed above in Table 5.3.1 in other to activate the objects to

function in all reliability as planned. As such Table 5.3.2 is given below,

showing the event procedures of the customer form and how the objects add

functionality to the system.

PROCEDURE ACTIONS-PSEUDOCODE

Button5_Click Searches data from the database

Button6_Click Deletes data from the Database

Button7_Click Updates data and re-save it to database

Button1_Click Shows the customer database in grid view

ComboBox4_SelectedIndexChanged Provides a list of Countries to be selected from

ComboBox1_SelectedIndexChanged_1 Provides a list showing gender(sex)

Button2_Click Clears text in textboxes, maskedtexboxes and Richtextboxes

Button3_Click Switch user from the present form to the next form

Button4_Click Saves the data on the present form to the database of that form

DateTimePicker1_ValueChanged Selects the date customer visited from the Calendar

Timer1_Tick Displays current time and Date on a label

Table 5.3.2: Event procedures of the customer form

A print screen to show the actual look of this form within the

advertisement recording system is as shown in figure 5.3.2 below.

14

Page 15: SD1046

Fig 5.3.2: Screen shot of the Customer form

As seen in fig 5.3.2, the customer form in its simplicity tries to capture

the basic details of a customer that intends to place an advert on MVS. The

form has four (4) buttons to the centre right of the form; these buttons are the

Search (to retrieve from database a customer information that has been

saved earlier), update (to enable user update information from database,

after which it is automatically saved to the database), Delete (for deleting an

unwanted record permanently from database) and View Database (to view all

customers and related information in the database).

The three buttons on the bottom of the form are clear (to clear fields in

the form), Save (to save customer information to database) and Next (to open

the next form (advert form) in the system to continue advert registration.

5.4 ADVERT FORM

15

Page 16: SD1046

PICTUREBOX 1

MyNUMERICUPDOWN 1

Textbox 1

RICHTEXTBOX1

ADVCOMBOBOX 1 TEXTBOX 4

TEXTBOX 3

DTPTEXTBOX 5

DATETIMPICKER 2

DATETIMPICKER 1

perCOMBOBOX 4

TEXTBOX 2

whenCOMBOBOX 3 LABEL 9

DurCOMBOBOX 2

COMBOBOX 2

COMBOBOX 1

BUTTON 2

BUTTON 8

BUTTON 1 BUTTON 4 BUTTON 3

BUTTON 5

BUTTON 7

BUTTON 6

COMBOBOX 3

LABEL 5

LABEL 6

LABEL 3

LABEL 16

LABEL 2

LABEL 1

LABEL 8

LABEL 7

LABEL 4

LABEL7

DaysTEXTBOX 6LABEL 13

GROUPBOX 2

GROUPBOX 1

LABEL7 MENU BAR

LABEL 12

LABEL 11

Label 15

Label 19

Fig 5.4.1, is a sketch of the advert form, it is simple in design and easy

to easy to use. This is one of the major forms in this system, in that

information filled into this form will help MVS record most important

information’s that will be needed from the customer concerning the advert to

be broadcasted.

The form is designed to hold details like, advert description, category,

how many minutes it will run for each broadcast, and calculate the amount

payable as charge for the advert etc

FIG 5.4.1: Sketch of the advert form in the MVS advertisement recording system

OBJECT NAME TEXT FORECOLOR

FONT READ ONLY

SIZE DROPDOWNN

16

Page 17: SD1046

STYLEAdvert Details

Form1 Advert FormActive Caption

LABEL

Label 18Multi Vision Services Malaysia

Linen 14 364,24

Label 17No 2, Jalan Kempumg, Nilai Malaysia

Blue 9 256,15

Label 11 Advert ID 10 63,16Label 12 Customer ID 10 81,16Label1 Advert Description 10 120,18Label 2 Advert Category 10 108,18Label 16 Received 10 69,18Label 3 To Appear 10 75,18Label 6 Timing 10 118,18

Label 5 Period 10 50,18

Label 4 When 10 45,18

Label 7 No of Days 10 75,18Label 8 Where 10 50,18Label 13 Amount Payable 10 108,18

Label 14 /minute

Label 15 Minutes

Label 19 Days

BUTTONS

Button1 calculate Blue 75,23

Button2 Clear Blue 75,23Button3 Continue Blue 75,23Button4 Save Blue 75,23Button5 SearchButton6 DeleteButton7 UpdateButton8 View database

COMBOBOX

ADVCombobox1

10 218,21 Dropdownlist

Combobox2 10 216,21 DropdownlistDurCombobox2

10 216,21 Dropdownlist

WhenCombobox3

10 216,21 Dropdownlist

PercomboBox 4

10 Dropdownlist

Combo box 1 10 DropdownlistCombo box 3 10

TEXTBOX

Textbox1 True 80,20Textbox2 True 102,21Textbox3 True 102,21DTPTextbox5 True 102,23Textbox4 True 214,20Daystextbox6 True

GROUPBOX

GroupBox1

GroupBox2 Access DatabaseRICHTEXTBOX

Richtextbox1 324,82

Table 5.4.1 Objects and properties of the Advert form

17

Page 18: SD1046

The addition of objects and changing of properties in a form alone

cannot add functionality to the form, the form can only become functional

when these objects are ordered to perform certain functions; this ordering is

done by adding the necessary and correct codes into the form under specific

objects.

Acknowledging the above facts; France-roosy Inc. has written the

coding to force this form’s objects function in the manner desired by MVS.

The event procedures of the advert form are outlined in the Table 5.4.2

below.

PROCEDURE ACTION-PSEUDOCODE

ComboBox1_SelectedIndexChanged Provides a list of advert category

DateTimePicker2_ValueChangedDisplays the present date on a textbox from the calendar

DateTimePicker1_ValueChangedDisplays the date the advert should be aired on a textbox from the calendar

ComboBox2_SelectedIndexChanged Displays the timing (minutes) of the advert

whenComboBox3_SelectedIndexChanged Displays when you want the advert to be aired

perComboBox4_SelectedIndexChangedDisplay the period of time the advert is to be aired per day

ComboBox2_SelectedIndexChanged_1Displays the number of days the advert is to be shown

ComboBox1_SelectedIndexChanged_1 Displays the region in which the advert is to be shown

Button2_ClickClears textboxes and richtextboxes in the present form

Button1_Click Calculates the amount payable by the customer

Button5_clickSearch record from database about a particular advert and display it in the current form

Button8_clickShows the advert database in gird view on a new window

Button6_click Deletes unwanted advert record from database

Button7_click Saves an edited record to database.

Button4_Click Saves the data on the present form into the database.

Button3_Click Moves from the present form to the next form

NumericUpDown1_Value Moves the counter from zero to the required number

Table 5.4.2: Event procedures of the Advert form

18

Page 19: SD1046

Fig 5.4.2: Screen shot of the advert form

The screen short of the advert form as seen in Figure 5.4.2 above has

eight buttons, all performing different important functions.

The clear button is used to clear all the fields in the form, whenever

there is an error entry or a new transaction is to be recorded. Next to the clear

button is the calculate button, when clicked; the system automatically

calculates the amount payable for that particular transaction based on the

information that has been selected in the previous fields and displays the

amount in the “amount payable” field.

The save button when clicked saves the details of the present

transaction to the database. While the continue button takes user to a new

form (Payment Form) to complete the transaction about that particular advert.

This button will only allow you access the payment form if the advert

description and amount payable fields are not empty. Else an error message

19

Page 20: SD1046

telling you to fill the appropriate field before proceeding as is shown in Figure

5.4.2 a and b

.

Fig

5.4.2(a): Calculate button error when advert description is not written.

Fig

5.4.2(b): Calculate button error when amount payable is not calculated

The form also contains four other buttons (Search, Update, Delete

and View Database) to the centre right of the form. For more information on

how these buttons function and their corresponding error messages refer to

the Appendix at the end of this document.

20

Page 21: SD1046

PICTURE BOX 1

TEXTBOX 2

TEXTBOX 1

TEXTBOX 3

TEXTBOX 4COMBOBOX 1LABEL 2

LABEL 3

LABE L 4

LABEL 5

TEXTBOX 5 Datetimepicker1

○ RADIOBUTTON 1

◌ RADIOBUTTON 2

◌ RADIOBUTTON 3

COMBOBOX 1

LABEL 2

LABEL 1

NUMERICUPDOWN 1

LABEL 13

TimeLABEL 16BUTTON 1

BUTTON 4

BUTTON 5

BUTTON 2BUTTON 3

GROUPBOX 2GROUPBOX1

MENU BAR

LABEL 6

LABEL 7

5.5 PAYMENT FORM

Figure 5.5.1 is a sketch of the payment form that holds financial details

concerning an advert, and profit expected from the advert. It consists of: how

the advert gets to MVS, (either through agents or directly from the individual),

if the advert fee was paid in full, part or yet to be paid for etc.

Fig 5.5.1: Sketch of the payment form in MVS advertisement recording system

. Table 5.51 below is an outline of the properties and objects that were

added to the GUI to produce the required design and result of the payment

form.

Object Name TextBackColour

ForeColour

Font SizeRead only

DropDownStyle

Label2 Client Activecaption

10(Bold)

43,18

21

Page 22: SD1046

LABEL

Label3Amount Payable

Activecaption

10(Bold)

112,18

Label4 VATActivecaption

10(Bold)

37,17

Label5 BalanceActivecaption

10(Bold)

60,18

Label1Multi Vision Services Malaysia

Activecaption

Linen14(Bold)

364,24

Label12

No 2, Jalan Kempumg, Nilai Malaysia

Activecaption

Blue 9 256,15

Label 6 AmountActivecaption

10

Label 7 DateActivecaption

10

Label13 Advert idActivecaption

10 74,13

Label 16Activecaption

Red12 (Bold)

BUTTON

Button2 Calculate 10Button3 ClearButton1 BackButton4 SaveButton5 Continue

TEXTBOX

Textbox1 164,22 TrueTextbox2 164,22 TrueTextbox3 164,22 TrueTextbox4 98,22Textbox5 98,22

PICTUREBOX

Picturebox1CompanyLogo

140,95

TIMELABEL

Timelabel16 RED

COMBOBOX

Combobox1 164,21DropDownlist

Table 5.5 .1: Objects and Properties of the payment form

The functionality of this payment form depends on the codes written

under the different objects, this can not be seen during runtime and User

needs to know the events that the objects in this form carry out. Hence the

events and procedures of this form are outlined in Table 5.5.2 below.

PROCEDURE ACTION-PSEUDOCODE

NumericUpDown1_ValueChanged Displays the form number from

22

Page 23: SD1046

ComboBox1_SelectedIndexChanged Displays the client in which the advert came from

DateTimePicker1_ValueChangedDisplays the date the money was paid from the calendar

Button6_click Opens the payment database in a new window

Button2_ClickCalculates the balance and the profit MVS will derive from that particular advert.

Button3_Click Clears the fields in the present form

Button1_Click redirects user to the previous form

Button4_ClickSaves the data on the present form to the database

Button5_Click Closes the form

Table 5.5.2: Events and procedures of the Payment form.

Fig 5.5.2: Screen shot of the payment form

When the payment form loads, you will notice that the amount payable

is transferred from the advert form to this form, all user have to do is to select

from the option list how the advert got to the TV channel and click calculate,

23

Page 24: SD1046

the system will calculate and display the profit (VAT) and the balance from the

amount payable, depending on who brought the advert to the channel. If MVS

is selected (directly from customer) then the VAT is 10% of the amount

payable else if it is agents then the system calculates 8% as VAT for MVS.

The save button saves these information to the database, while the

clear button clears the field in the form. The back button takes you back to

the advert form and view database button opens the payment database in a

grid view, finally the close button terminates the session by closing the form.

5.6 STAFF FORM

The staff form (Fig 5.6.1), is similar in design and functionality to the

customer form, the only difference between them is that the Staff form is used

to record and save to database all the staff’s or employees (new and old)

information of MVS. The properties and objects of the Staff form are

presented in Table 5.6.1.

24

Page 25: SD1046

PICTURE BOX 1

LABEL 1

LABEL 12

LABEL 3

TEXTBOX 1

TEXTBOX 2

TEXTBOX 3

TEXTBOX 4

TEXTBOX 5

RICHTEXTBOX 1

MASKEDTEXTBOX 1

COMBOBOX 4

TEXTBOX 6

COMBOBOX 2

BUTTON 5

BUTTON 7

BUTTON 6

BUTTON 8

BUTTON 2 BUTTON 3

LABEL 5

LABEL 2

LABEL 14

LABEL 15

LABEL 6

LABEL 13

LABEL 4

LABEL 7

LABEL 11

GROUPBOX 2

MENU BAR

◌ Radio button 2

○ Radio button 1

GROUPBOX 1

LABEL 16

LABEL 8

Fig 5.6.1: Sketch of Staff form in MVS advertisement recording system

Object Name TextAutoSize

ForeColour

Font Tab index SizeDropDownStyle

Back colour

Staff Form 4 Staff Form Active

25

Page 26: SD1046

Details Caption

LABELS

Label1Multi Vision Services Malaysia

Linen14Bold

364,24

Label12

No 2, Jalan Kempumg, Nilai Malaysia

Blue 9 256,15

Label2 Staff Details BLUE 12 79,16Label5 First Name 10 75,18

Label3Middle Name

10 91,18

Label4 Last Name 10 75,18Label13 Staff ID 10 55,18Label6 Email 10 44,18Label15 Address 10 6 61,18Label14 Phone No 10 7 73,18Label7 Date of Birth 10 82,18Label11 Nationality 10 73,18Label16 False RED 12 116,52

TEXTBOX

Textbox1 1 239,21Textbox2 2 239,21Textbox3 3 239,21Textbox4 4 239,21Textbox5 5 239,21Textbox6 8 239,21

PICTUREBOX

Picturebox1

CompanyLogo

140,95

MASKEDTEXTBOX

Maskedtextbox1

239,22

COMBOBOX

ComboBox1

ComboBox4

9 164,23DropDownlist

BUTTON

Button2 Clear 10 75,23Button3 Save 10

Button1View Database

10

Button 5 Search 10Button 6 Update 10Button 7 Delete 10

GROUPBOX

Groupbox1

Sex 122,92

GroupBox2

Access database

Table 5.6.1: Objects and Properties of the Staff Form

26

Page 27: SD1046

In order to activate the objects to function; codes are been written

under the above objects like buttons, timer, etc. The events and procedures of

this form is presented in Table 5.6.2 below.

PROCEDURE ACTION-PSEUDOCODE

Button5_clickSearch record from database and display in the form

Button2_ClickClears textboxes and rich textboxes in the present form

Button6_click Deletes a Staff record from database

Button7_click Saves an edited record to the database

Button3_ClickSaves the information on the present form into the database

Button1_ClickOpens the staff table of the database in a new window in datagridview

ComboBox4_SelectedIndexChanged Provides a list of countries to be chosen from

Combobox1_SelectedIndexchangedProvides a drop dawn list of staff’s last names to enable user search, update or delete record from database.

Form4_loadPulls all staff records saved in database to a combo box to enable search using last name

Table5.6. 2: Event and procedures of the Staff form

The staff form has similar features discussed above. Its functionality is

also similar to that of the customer form, by this we mean that the search,

updates, delete, save and view database buttons functions in the same. For

more information on how these buttons operate and their corresponding error

massages refer to appendix at the end of this document. Figure 5.6.2 below

is the print screen of the form.

27

Page 28: SD1046

Fig 5.6.2: screen shot of the staff form

28

Page 29: SD1046

PICTUREBOX 1

DATETIMEPICKER 1TEXTBOX 4

TEXTBOX 1

COMBOBOX 1

DATETIMEPICKER 1

RICHTEXTBOX 1COMBOBOX

TEXTBOX 5

TEXTBOX 6

LABEL 12

LABEL 2

LABEL 11

BUTTON 5

BUTTON 7

BUTTON 6

BUTTON 2BUTTON 1 BUTTON 3

○ RADIOBUTTON 3

○ RADIOBUTTON 2

◌ RADIOBUTTON 1LABEL 1

LABEL 4

LABEL 3

LABEL 5

LABEL 6

LABEL 7

GROUPBOX 1

GROUPBOX 2

MENU BAR

5.7 COMPLAINS FORM

Fig 5.7.1 is a sketch of the complain form in this system, it records

complains of customers who have one problem or the other concerning the

adverts they placed on MVS. It holds details like customer name, complain,

the advert category, and status of complain (if it is resolved or yet to be

attended to), etc.

Fig 5.7.1: Sketch of the complains form in MVS advertisement recording system

Objects were added to the original VB.NET GUI at design time, these

objects consist of default properties, but some of the original properties were

29

Page 30: SD1046

altered to meet user requirements and system specification. These objects

and properties that were altered are as shown in Table 5.7.1 below.

Object Name TextForeColour

Font SizeBorderStyle

Back colour

DropDownStyle

ComplainDetails Form 5

ComplainForm

ActiveCaption

LABEL

Label1 Customer Name 10 107,18Label4 Advert Category 10 107,18Label3 Received Date 10 101,18Label5 Supposed Date 10 105,18Label6 Complain 10 67,18Label7 Staff No 75,18

Label12No 2, Jalan Kempumg, Nilai Malaysia

Blue 9 256,15

Label2Multi Vision Services Malaysia

Linen 14 364,24

Label11 Red 12 120,56 3D

BUTTON

Button1 Clear 75,23

Button2 Save 75,23Button3 Exit 75,23Button 4 View DatabaseButton 5 SearchButton 6 DeleteButton 7 Update

GROUPBOX

Groupbox1 Complain StatusGroupbox2 Access DatabaseGroupbox3 158,95

TEXTBOX

Textbox 1 10 289,22Textbox 4 10 143,22

Textbox 5 10 143,22

Textbox 6 10 143,20

COMBOBOX

Combobox1 DropDownList

Combobox3 10 289,24DATETIMEPICKER

Date timePicker1

10 137,22

Date timePicker2

110 137,22

RICHTEXTBOX Richtextbox1 10 382,96

RADIOBUTTON

Radiobutton 1

Resolved

RadioButton2

Still in process

Radiobutton3

Not yet attended to

Table 5.7.1: Objects and properties of complain form.

30

Page 31: SD1046

The table below is the event and procedures of the complain form in

the Advert Recording System.

PROCEDURE ACTION-PSEUDOCODE

ComboBox1_SelectedIndexChanged Displays the advert category

DateTimePicker1_ValueChanged Displays the received date of the advert

DateTimePicker2_ValueChanged Displays the supposed date of the advert

GroupBox1_Enter Displays the options available for complain status

Button1_ClickClears textboxes and Rich textboxes in the present form

Button2_ClickSaves the data on the present form into the database

Button3_Click Exits from the present form

Button4_clickOpens the Complains table of the database in grid view

Button5_clickSearch a complain record from database and display it in the form

Button6_clik Deletes a record from database

Button7_click Saves an Edited record to database.

Table 5.7.2: Event and procedures of complains form

Fig 5.7.2 is a screen shot of the Complain form. It has buttons with

similar function to those earlier. The clear, save, search, update, delete and

exit buttons. Their functionality and notification messages are discussed in the

appendix of this document.

31

Page 32: SD1046

Fig 5.7.2: screen shot of the complains form

6. SYSTEM SETUP AND THE USER MANUAL

Just like any other software system the setting up of this advertisement

recording system is easy and fast. France-Roosy Inc. has designed this

system to ensure its easy installation on your computer. To install this system:

Insert the disc.

Open to view files, there are other files in this folder.

Double-click on ‘setup’

A user account control pop up window opens, asking you to allow or

cancel the program, identifying the publisher is unknown.

Click, allow to install

32

Page 33: SD1046

Wait for few seconds and the software (Windowsapplication6) is

installed in your system.

Now open from the desktop icon or click start in your computer and go

to all programs.

Locate Advert Recording System and click on it

This lunches the application.

You are now ready to start using the system.

The launched system opens with the login form as the gateway into the

system. This form requires you to have a valid username and password

registered with the system to enable you use the features of this system. To

register a new password click on the new user button and register a

username and password of your choice and log into the system.

To effectively use the forms in this system please refer back to our previous

discussions about the forms and there functionality.

7. MY ROLE IN THE VISUAL APPLICATION

Acknowledging the fact that this is a group assignment, it also consists

of personal parts that were administered by me. Sections 5.1 – 5.7 was done

as a group work , the explanations of each section was not detailed and as

such I personally added some more details to the drive home the points.

Nevertheless, this was done in all modesty without deviating from the original

group work plan. The design and coding of the system was done by me and

my group member.

All other sections of this documentation are a personal work by me,

including the password character check code to allow registration when

password is between 6- 15 characters. Else disallow the registration. extra

screen shots and explanations were also done within the documentation. The

Appendix of this document is my personal effort to explain important features

that were not in the group documentation.

33

Page 34: SD1046

8. CONCLUSION

The assignment was tedious and very stressful considering the short

interval (4weeks) given for the completion. Nevertheless, all things being

equal it has been completed and submitted before the due date.

Finally, I would want to conclude by saying that the system was tested,

validated and verified by France-Roosy Inc. in conjunction with other

programming associates, hence it is guaranteed that the system will run for at

least three (3) years before any possible maintenance would be required. An

exception would arise only if there are current policies of MVS changes and

there is an extra feature they may want to add to the system.

Else the system has been built to meet the user requirements as was

identified from the scenario released by MVS. Some extra features were also

added to improve the security of the system. E.g. the login form has been

coded to check the number of characters a user can register as a password

and further and making sure that user does not swap from one form to the

other without filling in the required fields of the one form.

34

Page 35: SD1046

9. REFERENCES

Big resources: getting even bigger, Access VB and SQL - Counting

Characters 2003, Viewed 20th July, 2010,

http://www.bigresource.com/VB-Access-VB-and-SQL-Counting-Characters-

IpzuVc0X.html.

Case, J & Millspough, A.C. 2002, Programming in visual basic version 6.0,

update edition, McGraw-hill: New York.

Cowell, J 2002, Essential VB .NET fast, springer-verlag: London.

Craig, J.C & Patrick, T 2006, Visual Basic 2005 cookbook, O’Reilly media

Inc: USA.

Deitel, H. M. & Deitel, P .J 2006, Visual Basic 2005: how to program, 3rd edn,

Prentice Hall: USA.

Dinesh, Beniwal 2009, ErrorProvider component in VB.NET viewed 20th

July 2010.

http://www.vbdotnetheaven.com/UploadFile/dbeniwal321/ErrorProvider10062

009074936AM/ErrorProvider.aspx.

Foxall, J.D 2006, Sams teach yourself Visual Basic 2005 in 24 hours:

complete starter kit, Sams publishing: USA.

Liberty, J 2003, Learning Visual Basic .NET, O’Reilly & associates Inc:

USA.

Maidasani, D 2007, Straight to the Point -Visual Basic 2005, firewell media:

New Delhi.

Mauer, L 2002, Sams teach yourself more Visual basic .Net in 21 days 3rd

edn, Sams publishing: USA.

35

Page 36: SD1046

Pathways W, Petroutsos E, McKeon, P.G, Stephens R, Keogh J, & Willis, T

2007, Introduction to Programming Using Visual Basic, John Wiley & Sons:

University of California.

Petrusha, R Lomax, P Patrick, T 2006, Visual Basic 2005 in a nutshell,

O’Reilly Media: USA.

Rod, S 2002, Visual Basic .NET database programming, Que Publishing:

USA.

Schneider, D.I 2006, An introduction to programming using Visual Basic

2005, 6th edition, Prentice hall: USA.

Vick, P 2004, The Visual Basic .NET programming language, Addison-

Wesley: USA.

36

Page 37: SD1046

10. APPENDIX

In discussing about the functionality and the corresponding user

notification messages of calculate, save, search, update, Delete, view

database and other related buttons; we will be using the advert form (Fig 1),

as a case study. This is because all the forms with aforementioned buttons in

this project have the same functionality and notification messages. Any other

form in the project would have been used and the concept will still remain the

same.

Fig 1: Screen print of the advert form for our case study

First, let’s start with the calculate button: This button when clicked

does some calculations and displays the amount in the amount payable form.

In filling the forms user is supposed to fill from top to down, if by chance a

user skips the advert category field and goes further to fill the timing

(minutes) field, the system generates a notification message as shown in fig

2a. If the user now fills in the advert category field and skip to fill the period

field the system will generate another message Fig 2b. Furthermore, if the

37

Page 38: SD1046

user fills in all the other fields in the form but skips the no of days field; by

the time he clicks the calculate button an error message (Fig 2c) is

generated.

Fig 2a: error message when timing is filled Fig 2b: error message when period field is

before advert category. Filled before timing

Fig 2c: when

calculate button is clicked without choosing no of day

.

Notice that when you choose a category of advert; the amount per

minute for that advert category is automatically displayed in the field beside it.

This is because the prevailing prices of the different categories of adverts

being run by MVS have been inculcated in the coding for that field. Table 1.1

presents the advert categories and the coded prevailing prices at MVS.

Ta

ble 1.1

:

Prevailing prices at MVS Malaysia for different advert category.

Advert category Price per minute as inculcated in the coding

SPORTS RM 200

FUNERAL RM 150

HEALTH RM 400

EDUCATION RM 450

ECONOMIC RM 250

COMMERCIAL RM 300

FASHION AND DESIGN RM 500

ENTERTAINMENT RM 350

38

Page 39: SD1046

The same is noticed for the timing and period field. The amount

displayed beside the Timing field is calculated thus: Price of the chosen

advert category X the no of minutes the advert will last for each broadcast.

The period ( (I) Morning, Afternoon, Evening, (II) Morning and

Afternoon, Afternoon and Evening, or Morning and Evening, (III) Morning,

Afternoon and Evening) when chosen displays an amount in the field beside

it. if the period was any of (I); the system multiplies the amount beside the

timing field by one (1), if it is any of (II); the amount is multiplied by two (2),

Else it multiplies it by three (3) and display the amount beside the period field

When the other fields are appropriately filled, click on the calculate button

and the amount payable is calculated by system using the formula shown

below:

Amount payable = Timing (minutes) x period (no of times per day).

While Timing = amount per minute (for the different categories) x length

of advert (no of minutes the advert will last).

This is done by the system and as such user does not need to border on

how to do this calculation.

For example, if an advert falls into the education category, just select

education from the advert category field and the field beside it displays

RM450, fill in the received and supposed date

Then select how many minutes the advert will last; say (3 minutes).

Now the field beside the timing field displays an amount (RM 1,350.00)

This amount was calculated as follows: advert category x timing (i.e.

450 x 3) to give RM1, 350.00.

Choose the period the advert will run: (I) morning, Afternoon, Evening,

(ii) Morning and Afternoon, Afternoon and Evening, or (iii) Morning,

Afternoon and Evening.

If we choose the any of (I); system calculates RM1,350.00 x 1, if we

choose any of (ii) then it becomes RM1,350.00 x 2 = RM2700, else

system will multiply 1,350.00 x 3 = RM4,050.00. And display the value

in the field beside the period field.

Now choose when, where and no of days: let’s choose 3.(for no of

days).

39

Page 40: SD1046

Lets now click on calculate button for system to calculate amount

payable. It has displayed RM8, 100.00 as amount payable.

This was what happened: period x no of days = Amount payable

2700 x 3 = RM 8,100.00

Depending on the period and no of days chosen system will calculate

the amount payable for that advert and display it in the amount payable

field.

Secondly, when the amount payable has been calculated, user can

now click on the save button to save the information to database. If the

information is entered correctly, user receives a notification as shown in (Fig

2d) meaning the record is saved to database and user can continue to the

next step. Else the message in (Fig 2e) is gotten and user has to restart the

process all over again.

Fig 2d: when record is saved to database Fig 2e: When the save is unsuccessful

When the record is successfully saved, the next action is to click the

continue button in other to go to the next form, this button in other forms like

the customer form (Next button) will check to see that no fields are left empty

else the corresponding error message relating to the omitted field is

displayed. In the advert form the continue button checks to make sure the

advert description and amount payable fields are calculated if not the

messages shown in Fig 4.2a and b, under advert form in this document are

displayed.

Third is the search button, when user desire to retrieve an information

about a particular customer, advert detail, complain detail or staff for the

purpose of editing or deleting such record from the database, the user has to

40

Page 41: SD1046

go into the access database area and click on the dropdown box provided. A

list of data’s is shown depending on the form. Click on any of the desired data,

it is displayed in the box, now click on the search button and the whole

information concerning that advert category or last name is displayed in the

appropriate fields (Fig 3) as where filled when the record was received

initially.

Fig 3: sample of the Search button in the MVS system

After this details are displayed; if you intent to make any changes to

this record you can do that by simply typing or selecting from the drop down

list for each field you want to make changes to, done? Then click UPDATE

button and the changes you made is automatically saved to the database.

This is confirmed by the notification shown in Fig 4.

41

Page 42: SD1046

Fig 4: confirmation message for an updated record

You can also delete a record from the database at will, when ever it is

no longer required, this can be done after the search function is successfully

carried out.

Meanwhile, if when the delete button is clicked, a window (Fig 5a ) is

opened asking if you want to delete that record from database, if you click

“yes” then the record is deleted; with the notice (Fig 5b), and if you click “No’

the record will not be deleted notifying you with Fig 6b.

Fig 5a: Message prompts to confirm delete on clicking the Delete button

Fig 5b: Confirmation of deleted record. Fig 5c: notification for a cancelled delete action

It should be noted that deleted records CANNOT be retrieved back into

database; hence it is advised that you be very sure you no longer need a

record again before clicking on the delete button.

42

Page 43: SD1046

At any point in time if you want to confirm an action carried out earlier,

whether it is saved, Updated or Deleted from database, just click on the View

Database button and you will see a window open as shown in fig 6. This is

the database in Data grid view.

Fig 6: Advert Table of database in its grid View

If you want to close this view just click on the EXIT button on the

bottom of the form and you will see the previous screen.

.SOURCE AND EXECUTABLE CODES

LOGIN FORM

Imports System.Data.OleDbImports System.IO

43

Page 44: SD1046

Public Class LoginForm1 Public con As New System.Data.OleDb.OleDbConnection("provider= microsoft.jet.oledb.4.0; data source=" & Application.StartupPath & "\MVS.mdb;") ' TODO: Insert code to perform custom authentication using the provided username and password ' (See http://go.microsoft.com/fwlink/?LinkId=35339). ' The custom principal can then be attached to the current thread's principal as follows: ' My.User.CurrentPrincipal = CustomPrincipal ' where CustomPrincipal is the IPrincipal implementation used to perform authentication. ' Subsequently, My.User will return identity information encapsulated in the CustomPrincipal object ' such as the username, display name, etc.

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click Try Dim x As New OleDbCommand("SELECT * FROM MYV_TABLE WHERE staffu = ('" & Textbox1.Text & "')", con) Dim y As OleDbDataReader con.Open() y = x.ExecuteReader y.Read() If Textbox1.Text = y.Item("staffu") Then MsgBox("Username is Correct") If Textbox2.Text = y.Item("staffp") Then MsgBox("Password is correct") Timer1.Enabled = True Else MsgBox("password is wrong") Textbox2.Clear() End If Else MsgBox("Username is wrong") Textbox1.Clear() End If

Catch ex As Exception MsgBox("no user") Textbox1.Clear() Textbox2.Clear() End Try con.Close() End Sub

Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click Me.Close() End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click LoginForm2.ShowDialog() End Sub

Private Sub LoginForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load File.SetAttributes(Application.StartupPath & "\MVS.mdb", FileAttributes.Hidden)

44

Page 45: SD1046

ErrorProvider1.SetError(Textbox2, "Your Password should be between 6 and 15 characters") End Sub

Private Sub Textbox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Textbox2.TextChanged

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If ToolStripProgressBar1.Value < 20 Then ToolStripProgressBar1.Value = ToolStripProgressBar1.Value + 1 Else Timer1.Enabled = False Me.Hide() Form6.Show() End If End SubEnd Class

45

Page 46: SD1046

PASSWORD REGISTRATION FORM

Imports System.DataImports System.IO

Public Class LoginForm2 Dim query As OleDb.OleDbCommand Public con As New System.Data.OleDb.OleDbConnection("provider= microsoft.jet.oledb.4.0; data source=" & Application.StartupPath & "\MVS.mdb;") ' TODO: Insert code to perform custom authentication using the provided username and password ' (See http://go.microsoft.com/fwlink/?LinkId=35339). ' The custom principal can then be attached to the current thread's principal as follows: ' My.User.CurrentPrincipal = CustomPrincipal ' where CustomPrincipal is the IPrincipal implementation used to perform authentication. ' Subsequently, My.User will return identity information encapsulated in the CustomPrincipal object ' such as the username, display name, etc.

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click Try Dim x As String If UsernameTextBox.Text = "" Then MsgBox("pls enter Username") UsernameTextBox.Focus() ElseIf PasswordTextBox.Text = "" Then MsgBox("pls enter Password") PasswordTextBox.Focus() ElseIf TextBox1.Text = "" Then MsgBox("pls confirm Password") TextBox1.Focus() ElseIf PasswordTextBox.Text = TextBox1.Text Then x = MessageBox.Show("Do you want to save as new user?", "Confirm Your registration", MessageBoxButtons.YesNo) If x = vbYes Then query = New OleDb.OleDbCommand("insert into MYV_TABLE(staffu,staffp)values('" & UsernameTextBox.Text & "','" & PasswordTextBox.Text & "')", con) con.Open() query.ExecuteNonQuery() con.Close() MsgBox("record saved") MsgBox("You Can Now Login with Your Username and Password") LoginForm1.Show() Me.Hide() Else MsgBox("pls re-enter your password, The password you entered did not match", MsgBoxStyle.Information) PasswordTextBox.Clear() TextBox1.Clear() PasswordTextBox.Focus() End If End If Catch ex As Exception MsgBox("You have Not registered any Password")

46

Page 47: SD1046

End Try End Sub

Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click LoginForm1.Show()

End Sub

Private Sub LoginForm2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ErrorProvider1.SetError(PasswordTextBox, "Your Password should be between 6 and 15 characters") File.SetAttributes(Application.StartupPath & "\MVS.mdb", FileAttributes.Hidden) End Sub

Private Sub PasswordTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasswordTextBox.TextChanged

End Sub

Private Sub TextBox1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.MouseEnter

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Try Dim pws As Integer pws = 0 pws = Len(PasswordTextBox.Text) If pws <= "5" Then MsgBox("Your password is below six characters please enter a password that is six characters or above", vbExclamation, "Error!") 'displays message box PasswordTextBox.Clear() TextBox1.Clear() PasswordTextBox.Focus() Exit Sub ElseIf pws >= "15" Then MsgBox("Your password is above fifteen characters please enter a password that is below fifteen characters", vbExclamation, "Error!") 'displays message box End If Catch ex As Exception

End Try

End SubEnd Class

47

Page 48: SD1046

ADVERT FORM

Imports system.Data.OleDbImports System.IOPublic Class Form1 Dim query As OleDb.OleDbCommand Public con As New System.Data.OleDb.OleDbConnection("provider= microsoft.jet.oledb.4.0; data source=" & Application.StartupPath & "\MVS.mdb;")

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try If ComboBox2.SelectedItem = "" Then MessageBox.Show("PEASE ENTER HOW LONG THIS ADVERT WILL LAST") Else daysTextBox6.Text = CDbl(Label9.Text) * CDbl(ComboBox2.SelectedItem) daysTextBox6.Text = CDbl(daysTextBox6.Text).ToString("C") End If DurComboBox2.Text = "Minutes" + DurComboBox2.SelectedItem ComboBox2.Text = "Days" + ComboBox2.Text Catch ex As Exception MessageBox.Show("Enter All Fileds") End Try End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ADVComboBox1.SelectedIndexChanged If ADVComboBox1.SelectedItem = "SPORT" Then TextBox4.Text = "200" ElseIf ADVComboBox1.SelectedItem = "ECONOMIC" Then TextBox4.Text = "250" ElseIf ADVComboBox1.SelectedItem = "FUNERAL" Then TextBox4.Text = "150" ElseIf ADVComboBox1.SelectedItem = "COMMERCIAL" Then TextBox4.Text = "350" ElseIf ADVComboBox1.SelectedItem = "HEALTH" Then TextBox4.Text = "400" ElseIf ADVComboBox1.SelectedItem = "FASHION & DESIGN" Then TextBox4.Text = "500" ElseIf ADVComboBox1.SelectedItem = "EDUCATION" Then TextBox4.Text = "450" ElseIf ADVComboBox1.SelectedItem = "ENTERTAINMENT" Then TextBox4.Text = "350" End If TextBox4.Text = CDbl(TextBox4.Text).ToString("C") End Sub

Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox2.Clear()

48

Page 49: SD1046

TextBox4.Clear() TextBox3.Clear() daysTextBox6.Clear() DTPTextBox5.Clear() Label9.Text = "" RichTextBox1.Clear() Me.Refresh() End Sub

Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DurComboBox2.SelectedIndexChanged Try If DurComboBox2.SelectedValue <> -1 Then TextBox2.Text = CInt(DurComboBox2.SelectedItem) * CInt(TextBox4.Text) TextBox2.Text = CInt(TextBox2.Text).ToString("C") End If Catch ex As Exception MsgBox("Choosse Advert category first!") End Try End Sub

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

End Sub

Private Sub ComboBox2_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DurComboBox2.SelectedValueChanged

End Sub

Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged DTPTextBox5.Text = DateTimePicker1.Value.Date End Sub

Private Sub DTPTextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DTPTextBox5.TextChanged DTPTextBox5.Text = DateTimePicker1.Value.Date End Sub

Private Sub whenComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles whenComboBox3.SelectedIndexChanged If TextBox2.Text = "" Then MsgBox("Enter How Many Minutes This Advert Will Last") DurComboBox2.Focus() ElseIf whenComboBox3.SelectedItem = "EVENING" Then Label9.Text = TextBox2.Text ElseIf whenComboBox3.SelectedItem = "MORNING" Then Label9.Text = TextBox2.Text ElseIf whenComboBox3.SelectedItem = "AFTERNOON" Then Label9.Text = TextBox2.Text ElseIf whenComboBox3.SelectedItem = "MORNING and AFTERNOON" Then Label9.Text = CDbl(TextBox2.Text * 2).ToString("C")

49

Page 50: SD1046

ElseIf whenComboBox3.SelectedItem = "AFTERNOON and EVENING" Then Label9.Text = CDbl(TextBox2.Text * 2).ToString("C") Else Label9.Text = CDbl(TextBox2.Text * 3).ToString("C") End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TextBox1.Text = Form3.NumericUpDown1.Value File.SetAttributes(Application.StartupPath & "\MVS.mdb", FileAttributes.Hidden) Try Dim x As New DataSet Dim dr As DataRow Dim Z As DataTable Dim xyz As New OleDbDataAdapter("select * from ADVERT_TABLE", con) xyz.Fill(x, "ADVERT_TABLE") Z = x.Tables(0) ComboBox3.Items.Clear() For Each dr In Z.Rows ComboBox3.Items.Add(dr.Item("advert_category")) Next Catch ex As Exception MsgBox("the database cannot be found. Try Again") End Try myNumericUpDown1.Value = myNumericUpDown1.Value + 1 End Sub

Private Sub ComboBox1_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

End Sub

Private Sub daysTextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles daysTextBox6.TextChanged

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click If RichTextBox1.Text = "" Then MessageBox.Show("Enter Advert Description", "Omitted Field Error", MessageBoxButtons.OK, MessageBoxIcon.Error) RichTextBox1.Focus() Form2.Hide() ElseIf daysTextBox6.Text = "" Then MessageBox.Show("Amount Payable is not Calculated", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning) Form2.Hide() Else Form2.ShowDialog() End If End Sub

Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles myNumericUpDown1.ValueChanged

50

Page 51: SD1046

End Sub

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

End Sub

Private Sub OPenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OPenToolStripMenuItem.Click Dim strfilename As String OpenFileDialog1.InitialDirectory = "c;\" OpenFileDialog1.Title = "open an image" OpenFileDialog1.Filter = "jpeg|*.jpeg|*.jpg|*.bmp|*.gif|*" OpenFileDialog1.ShowDialog() strfilename = OpenFileDialog1.FileName PictureBox1.Image = Image.FromFile(strfilename) OpenFileDialog1.Reset() End Sub

Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click SaveFileDialog1.Filter = "jpeg*.jpeg|*" If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then PictureBox1.Image.Save(SaveFileDialog1.FileName) End If End Sub

Private Sub BackgroundColourToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackgroundColourToolStripMenuItem.Click ColorDialog1.Color = Me.RichTextBox1.ForeColor ColorDialog1.ShowDialog() RichTextBox1.ForeColor = ColorDialog1.Color End Sub

Private Sub FontColourToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontColourToolStripMenuItem.Click ColorDialog1.Color = Me.RichTextBox1.ForeColor ColorDialog1.ShowDialog() RichTextBox1.ForeColor = ColorDialog1.Color End Sub

Private Sub ToUppToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToUppToolStripMenuItem.Click RichTextBox1.Text = RichTextBox1.Text.ToUpper() End Sub

Private Sub ToLowerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToLowerToolStripMenuItem.Click RichTextBox1.Text = RichTextBox1.Text.ToLower End Sub

51

Page 52: SD1046

Private Sub ExitToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem2.Click Me.Close() End Sub

Private Sub RedoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem.Click RichTextBox1.Redo() End Sub

Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem.Click RichTextBox1.Undo() End Sub

Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click TextBox1.Copy() RichTextBox1.Copy() End Sub

Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click RichTextBox1.Paste() End Sub

Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click RichTextBox1.Cut() End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Try If RichTextBox1.Text = "" Then MessageBox.Show("Enter Advert Description", "Omitted Field Error", MessageBoxButtons.OK, MessageBoxIcon.Error) RichTextBox1.Focus() Else query = New OleDb.OleDbCommand("insert into ADVERT_TABLE(advert_id,customer_id, advert_description, advert_category, advert_time,time_of_day,to_show, to_cover,amount_payable, supposed_date, recieved_date,no_of_days)values(" & myNumericUpDown1.Value & "," & TextBox1.Text & ",'" & RichTextBox1.Text & "','" & ADVComboBox1.SelectedItem & "'," & DurComboBox2.Text & ",'" & whenComboBox3.SelectedItem & "','" & perComboBox4.SelectedItem & "','" & ComboBox1.SelectedItem & "','" & daysTextBox6.Text & "','" & DTPTextBox5.Text & "','" & TextBox3.Text & "','" & ComboBox2.SelectedItem & "')", con) con.Open() query.ExecuteNonQuery() con.Close() MessageBox.Show("Record Saved") End If

52

Page 53: SD1046

Catch ex As Exception MessageBox.Show("Record Not Saved, Make Sure 'Amount Payable' is calculated") End Try End Sub

Private Sub DateTimePicker2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker2.ValueChanged TextBox3.Text = DateTimePicker2.Value.Date End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Try Dim xyz As New OleDbCommand("SELECT * FROM ADVERT_TABLE WHERE advert_category = ('" & ComboBox3.SelectedItem & "')", con) Dim x As OleDbDataReader con.Open() x = xyz.ExecuteReader x.Read() myNumericUpDown1.Value = x.Item("advert_id") TextBox1.Text = x.Item("customer_id") RichTextBox1.Text = x.Item("advert_description") ADVComboBox1.SelectedItem = x.Item("advert_category") DurComboBox2.Text = x.Item("advert_time") whenComboBox3.Text = x.Item("time_of_day") perComboBox4.Text = x.Item("to_show") ComboBox1.Text = x.Item("to_cover") daysTextBox6.Text = x.Item("amount_payable") daysTextBox6.Text = "RM" + daysTextBox6.Text DTPTextBox5.Text = x.Item("supposed_date") TextBox3.Text = x.Item("recieved_date") ComboBox2.SelectedItem = x.Item("no_of_days") con.Close() Me.Refresh() Catch ex As Exception MsgBox("ERROR") End Try End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click Dim francis As String = "UPDATE ADVERT_TABLE SET advert_id =('" & myNumericUpDown1.Value & "'),customer_id =('" & TextBox1.Text & "'),advert_description =('" & RichTextBox1.Text & "'),advert_category =('" & ADVComboBox1.Text & "'),advert_time =('" & DurComboBox2.Text & "'),time_of_day =('" & whenComboBox3.Text & "'),to_show =('" & perComboBox4.Text & "'),to_cover =('" & ComboBox1.SelectedItem & "'),amount_payable =('" & daysTextBox6.Text & "'),supposed_date =('" & DTPTextBox5.Text & "'),recieved_date =('" & TextBox3.Text & "'),no_of_days =('" & ComboBox2.SelectedItem & "') WHERE advert_id = ('" & myNumericUpDown1.Value & "')" Dim xyz As New OleDbCommand(francis, con) con.Open() xyz.ExecuteNonQuery() MsgBox("Advert Detail has Been Is Updated") con.Close()

End Sub

53

Page 54: SD1046

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Try Dim x As String x = MessageBox.Show("Do You Want This Record Deleted From Database?", "CONFIRM DELETE", MessageBoxButtons.YesNo) If x = vbYes Then Dim xyz As New OleDbCommand("DELETE * FROM ADVERT_TABLE WHERE advert_category = ('" & ComboBox3.SelectedItem & "')", con) con.Open() xyz.ExecuteReader() MessageBox.Show("DELETED") con.Close() Else MessageBox.Show("NOT DELETED")

End If Catch ex As Exception MsgBox("ERROR") End Try End Sub

Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click Form9.ShowDialog() End Sub

Private Sub ComboBox2_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged

End Sub

Private Sub Form1_MaximumSizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MaximumSizeChanged 'PictureBox1.Left = PictureBox1.Left + 100 End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label10.Text = Now End Sub

Private Sub FontSizeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontSizeToolStripMenuItem.Click

End Sub

Private Sub AllignToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AllignToolStripMenuItem.Click

End Sub

54

Page 55: SD1046

Private Sub ToRightToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToRightToolStripMenuItem.Click

End Sub

Private Sub ToCenterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToCenterToolStripMenuItem.Click

End SubEnd Class

55

Page 56: SD1046

COMPLAIN FORM

Imports System.Data.OleDbImports System.IO

Public Class Form5 Dim query As OleDb.OleDbCommand Public con As New System.Data.OleDb.OleDbConnection("provider= microsoft.jet.oledb.4.0; data source=" & Application.StartupPath & "\MVS.mdb;")

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label11.Text = Now End Sub

Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged TextBox4.Text = DateTimePicker1.Value.Date

End Sub

Private Sub DateTimePicker2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker2.ValueChanged TextBox5.Text = DateTimePicker2.Value.Date End Sub

Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click TextBox1.Copy() TextBox6.Copy() RichTextBox1.Copy() End Sub

Private Sub SelectAllToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllToolStripMenuItem1.Click RichTextBox1.SelectAll() TextBox1.SelectAll() TextBox6.SelectAll() End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.Close()

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Clear() RichTextBox1.Clear() TextBox6.Clear() Me.Refresh() End Sub

56

Page 57: SD1046

Private Sub OPenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OPenToolStripMenuItem.Click Dim strfilename As String OpenFileDialog1.InitialDirectory = "c;\" OpenFileDialog1.Title = "open an image" OpenFileDialog1.Filter = "jpeg|*.jpeg|*.jpg|*.bmp|*.gif|*" OpenFileDialog1.ShowDialog() strfilename = OpenFileDialog1.FileName PictureBox1.Image = Image.FromFile(strfilename) OpenFileDialog1.Reset() End Sub

Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click SaveFileDialog1.Filter = "jpeg*.jpeg|*" If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then PictureBox1.Image.Save(SaveFileDialog1.FileName) End If End Sub

Private Sub FontColourToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontColourToolStripMenuItem.Click ColorDialog1.Color = Me.TextBox1.ForeColor ColorDialog1.ShowDialog() TextBox1.ForeColor = ColorDialog1.Color End Sub

Private Sub BackgroundColourToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackgroundColourToolStripMenuItem.Click ColorDialog1.Color = Me.RichTextBox1.ForeColor ColorDialog1.ShowDialog() RichTextBox1.ForeColor = ColorDialog1.Color End Sub

Private Sub ToUppToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToUppToolStripMenuItem.Click RichTextBox1.Text = RichTextBox1.Text.ToUpper() TextBox1.Text = TextBox1.Text.ToUpper TextBox6.Text = TextBox1.Text.ToUpper End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim x As String If RadioButton1.Checked = True Then x = "Resolved" ElseIf RadioButton2.Checked = True Then x = "Still In Process" Else x = "Not Yet Attended To" End If Try query = New OleDb.OleDbCommand("insert into COMPLAIN_FORM(customer_name,advert_category,recieved_date,supposed_date,complain,staff_id,complain_status,complain_date)values('" &

57

Page 58: SD1046

TextBox1.Text & "','" & ComboBox1.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & RichTextBox1.Text & "','" & TextBox6.Text & "','" & x & "','" & Label11.Text & "')", con) con.Open() query.ExecuteNonQuery() MessageBox.Show("Record Saved") con.Close() Catch ex As Exception MessageBox.Show("Record Not Saved") End Try End Sub

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

Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load File.SetAttributes(Application.StartupPath & "\MVS.mdb", FileAttributes.Hidden) Try Dim x As New DataSet Dim dr As DataRow Dim Z As DataTable Dim xyz As New OleDbDataAdapter("select * from COMPLAIN_FORM", con) xyz.Fill(x, "COMPLAIN_FORM") Z = x.Tables(0) ComboBox3.Items.Clear() For Each dr In Z.Rows ComboBox3.Items.Add(dr.Item("customer_name")) Next Catch ex As Exception MsgBox("the database cannot be found. Try Again") End Try End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Try Dim xyz As New OleDbCommand("SELECT * FROM COMPLAIN_FORM WHERE customer_name = ('" & ComboBox3.SelectedItem & "')", con) Dim x As OleDbDataReader Button6.Enabled = True Button7.Enabled = True con.Open() x = xyz.ExecuteReader x.Read() TextBox1.Text = x.Item("customer_name") ComboBox1.SelectedItem = x.Item("advert_category") TextBox4.Text = x.Item("recieved_date") TextBox5.Text = x.Item("supposed_date") RichTextBox1.Text = x.Item("complain") TextBox6.Text = x.Item("staff_id") Label11.Text = x.Item("complain_date") con.Close() Catch ex As Exception MsgBox("ERROR") Me.Refresh() End Try

58

Page 59: SD1046

End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click If TextBox1.Text = "" Then MsgBox("Update was unssuccesful, Enter customer name") ElseIf ComboBox1.SelectedItem = "" Then MsgBox("Update was unssuccesful, Enter advert category") ElseIf RichTextBox1.Text = "" Then MsgBox("Update was unssuccesful, Enter complain") ElseIf TextBox6.Text = "" Then MsgBox("Update was unssuccesful, Enter Staff Id") Else Dim francis As String = "UPDATE COMPLAIN_FORM SET customer_name =('" & TextBox1.Text & "'),advert_category =('" & ComboBox1.Text & "'),recieved_date =('" & TextBox4.Text & "'),supposed_date =('" & TextBox5.Text & "'),complain =('" & RichTextBox1.Text & "'),staff_id =('" & TextBox6.Text & "'),complain_date =('" & Label11.Text & "') WHERE customer_name = ('" & TextBox1.Text & "')" Dim xyz As New OleDbCommand(francis, con) con.Open() xyz.ExecuteNonQuery() MsgBox("Complain Detail has Been Is Updated") con.Close() End If End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Try Dim x As String x = MessageBox.Show("Do You Want This Record Deleted From Database?", "CONFIRM DELETE", MessageBoxButtons.YesNo) If x = vbYes Then Dim xyz As New OleDbCommand("DELETE * FROM COMPLAIN_FORM WHERE customer_name = ('" & ComboBox3.SelectedItem & "')", con) con.Open() xyz.ExecuteReader() MessageBox.Show("DELETED") con.Close() Else MessageBox.Show("NOT DELETED")

End If Catch ex As Exception MsgBox("ERROR") End Try End Sub

Private Sub RedoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem.Click RichTextBox1.Redo() End Sub

Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem.Click TextBox1.Undo()

59

Page 60: SD1046

RichTextBox1.Undo() TextBox6.Undo()

End Sub

Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click TextBox1.Paste() RichTextBox1.Paste() End Sub

Private Sub Label11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label11.Click

End SubEnd Class

60

Page 61: SD1046

CUSTOMER FORM

Imports System.Data.OleDbImports System.IO

Public Class Form3 Dim query As OleDb.OleDbCommand Public con As New System.Data.OleDb.OleDbConnection("provider= microsoft.jet.oledb.4.0; data source=" & Application.StartupPath & "\MVS.mdb;") Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load File.SetAttributes(Application.StartupPath & "\MVS.mdb", FileAttributes.Hidden) Try Dim x As New DataSet Dim dr As DataRow Dim Z As DataTable Dim xyz As New OleDbDataAdapter("select * from CUSTOMER_TABLE", con) xyz.Fill(x, "CUSTOMER_TABLE") Z = x.Tables(0) ComboBox2.Items.Clear() For Each dr In Z.Rows ComboBox2.Items.Add(dr.Item("last_name")) Next Catch ex As Exception MsgBox("the database cannot be found. Try Again") End Try End Sub

Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged

End Sub

Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged

End Sub

Private Sub OPenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OPenToolStripMenuItem.Click Try Dim strfilename As String OpenFileDialog1.InitialDirectory = "c;\" OpenFileDialog1.Title = "open an image" OpenFileDialog1.Filter = "jpeg|*.jpeg|*.jpg|*.bmp|*.gif|*" OpenFileDialog1.ShowDialog() strfilename = OpenFileDialog1.FileName PictureBox1.Image = Image.FromFile(strfilename)

61

Page 62: SD1046

OpenFileDialog1.Reset() Catch ex As Exception MsgBox("Error") End Try End Sub

Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click SaveFileDialog1.Filter = "jpeg*.jpeg|*" If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then PictureBox1.Image.Save(SaveFileDialog1.FileName) End If End Sub

Private Sub BackgroundColourToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackgroundColourToolStripMenuItem.Click ColorDialog1.Color = Me.RichTextBox1.ForeColor ColorDialog1.ShowDialog() RichTextBox1.ForeColor = ColorDialog1.Color End Sub

Private Sub FontColourToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontColourToolStripMenuItem.Click ColorDialog1.Color = Me.TextBox1.ForeColor ColorDialog1.ShowDialog() TextBox1.ForeColor = ColorDialog1.Color End Sub

Private Sub ToUppToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToUppToolStripMenuItem.Click

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

End Sub

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

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() TextBox6.Clear()

62

Page 63: SD1046

MaskedTextBox1.Clear() RichTextBox1.Clear() NumericUpDown1.Value = NumericUpDown1.Value + 1 Me.Refresh() End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Try If TextBox1.Text = "" Then MsgBox("Enter Your First Name") TextBox1.Focus() Form1.Hide() ElseIf TextBox3.Text = "" Then MsgBox("Enter Your Last Name") TextBox3.Focus() Form1.Hide() ElseIf TextBox4.Text = "" Then MsgBox("Enter Your Email Address") TextBox4.Focus() Form1.Hide() ElseIf RichTextBox1.Text = "" Then MsgBox("Pease Enter Your home address") RichTextBox1.Focus() Form1.Hide() ElseIf TextBox5.Text = "" Then MsgBox("When did you recieve this customer?") DateTimePicker1.Focus() Form1.Hide() ElseIf ComboBox4.Text = "" Then MsgBox("No Nationality") ComboBox4.Focus() Form1.Hide() Else Form1.ShowDialog() End If Catch ex As Exception MsgBox("Fill all fields") End Try End Sub

Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox4.SelectedIndexChanged End Sub

Private Sub MaskedTextBox1_MaskInputRejected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MaskInputRejectedEventArgs) Handles MaskedTextBox1.MaskInputRejected MaskedTextBox1.Focus() End Sub

Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged TextBox5.Text = DateTimePicker1.Value.Date()

End Sub

63

Page 64: SD1046

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

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Try query = New OleDb.OleDbCommand("insert into CUSTOMER_TABLE(customer_id,first_name,middle_name,last_name,email,phone_no,dob,nationality,sex,date_of_visit,address,update_form)values(" & NumericUpDown1.Value & ",'" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & MaskedTextBox1.Text & "','" & TextBox6.Text & "','" & ComboBox4.Text & "','" & ComboBox1.Text & "','" & TextBox5.Text & "','" & RichTextBox1.Text & "','" & ComboBox2.Text & "')", con) con.Open() query.ExecuteNonQuery() con.Close() MessageBox.Show("Record Saved") Catch ex As Exception MessageBox.Show("Record Not Saved") End Try End Sub

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

End Sub

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

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Try Dim xyz As New OleDbCommand("SELECT * FROM CUSTOMER_TABLE WHERE last_name = ('" & ComboBox2.SelectedItem & "')", con) Dim x As OleDbDataReader con.Open() x = xyz.ExecuteReader x.Read() ComboBox4.SelectedItem = x.Item("nationality") TextBox1.Text = x.Item("first_name") TextBox2.Text = x.Item("middle_name") TextBox3.Text = x.Item("last_name") TextBox4.Text = x.Item("email") TextBox5.Text = x.Item("date_of_visit") TextBox6.Text = x.Item("dob") RichTextBox1.Text = x.Item("address") MaskedTextBox1.Text = x.Item("phone_no") ComboBox1.SelectedItem = x.Item("sex") NumericUpDown1.Value = x.Item("customer_id") con.Close() Catch ex As Exception MsgBox("ERROR") End Try Button6.Enabled = True ComboBox2.Visible = True

64

Page 65: SD1046

End Sub

Private Sub ComboBox2_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Try Dim x As String x = MessageBox.Show("Do You Want This Record Deleted From Database?", "CONFIRM DELETE", MessageBoxButtons.YesNo) If x = vbYes Then Dim xyz As New OleDbCommand("DELETE * FROM CUSTOMER_TABLE WHERE nationality = ('" & ComboBox2.SelectedItem & "')", con) 'Dim x As OleDbDataReader con.Open() xyz.ExecuteReader() MessageBox.Show("DELETED") con.Close() Else MessageBox.Show("NOT DELETED")

End If Catch ex As Exception MsgBox("ERROR") End Try End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click Dim francis As String = "UPDATE CUSTOMER_TABLE SET customer_id =('" & NumericUpDown1.Value & "'),first_name =('" & TextBox1.Text & "'),middle_name =('" & TextBox2.Text & "'),last_name =('" & TextBox3.Text & "'),email =('" & TextBox4.Text & "'),phone_no =('" & MaskedTextBox1.Text & "'),dob =('" & TextBox6.Text & "'),nationality =('" & ComboBox4.SelectedItem & "'),sex =('" & ComboBox1.Text & "'),date_of_visit =('" & TextBox5.Text & "'),address =('" & RichTextBox1.Text & "') WHERE customer_id = ('" & NumericUpDown1.Value & "')" Dim xyz As New OleDbCommand(francis, con) con.Open() xyz.ExecuteNonQuery() MsgBox("Customer Detail Is Updated") con.Close()

End Sub

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

Private Sub RedoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem.Click RichTextBox1.Redo()

65

Page 66: SD1046

End Sub

Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem.Click TextBox1.Undo() TextBox2.Undo() TextBox3.Undo() TextBox4.Undo() TextBox6.Undo() MaskedTextBox1.Undo() RichTextBox1.Undo() End Sub

Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click TextBox1.Copy() TextBox2.Copy() TextBox3.Copy() TextBox4.Copy() TextBox5.Copy() TextBox6.Copy() RichTextBox1.Copy() End Sub

Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click TextBox1.Paste() TextBox2.Paste() TextBox3.Paste() TextBox4.Paste() TextBox5.Paste() TextBox6.Paste() RichTextBox1.Paste() End Sub

Private Sub PreviousToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PreviousToolStripMenuItem.Click Enabled = False End Sub

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Form8.ShowDialog() End Sub

Private Sub Form3_MaximumSizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MaximumSizeChanged

End Sub

Private Sub Form3_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

66

Page 67: SD1046

'Label1.Text = Now End Sub

Private Sub ExitToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem2.Click Me.Close() End Sub

Private Sub Label11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label11.Click

End Sub

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

End SubEnd Class

67

Page 68: SD1046

PAYMENT FORM

Imports System.Data.OleDbImports System.IOPublic Class Form2 Dim query As OleDb.OleDbCommand Public con As New System.Data.OleDb.OleDbConnection("provider= microsoft.jet.oledb.4.0; data source=" & Application.StartupPath & "\MVS.mdb;")

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

End Sub

Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged

End Sub

Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged TextBox5.Text = DateTimePicker1.Value.Date End Sub

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

End Sub

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

Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged

End Sub

Private Sub OPenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OPenToolStripMenuItem.Click Dim strfilename As String OpenFileDialog1.InitialDirectory = "c;\" OpenFileDialog1.Title = "open an image" OpenFileDialog1.Filter = "jpeg|*.jpeg|*.jpg|*.bmp|*.gif|*" OpenFileDialog1.ShowDialog() strfilename = OpenFileDialog1.FileName PictureBox1.Image = Image.FromFile(strfilename) OpenFileDialog1.Reset() End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

End Sub

68

Page 69: SD1046

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Try If ComboBox1.SelectedItem = "MVS" Then TextBox2.Text = CDbl(TextBox1.Text * 10 / 100).ToString("C") ElseIf ComboBox1.SelectedItem = "AGENTS" Then TextBox2.Text = CDbl(TextBox1.Text * 8 / 100).ToString("C") End If TextBox3.Text = CDbl(TextBox1.Text - TextBox2.Text).ToString("C") Catch ex As Exception MsgBox("Error Calculate Amount Payable") End Try End Sub

Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click SaveFileDialog1.Filter = "jpeg*.jpeg|*" If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then PictureBox1.Image.Save(SaveFileDialog1.FileName) End If End Sub

Private Sub ExitToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem2.Click Me.Close()

End Sub

Private Sub FontColourToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontColourToolStripMenuItem.Click ColorDialog1.Color = Me.TextBox1.ForeColor ColorDialog1.ShowDialog() TextBox1.ForeColor = ColorDialog1.Color End Sub

Private Sub BackgroundColourToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackgroundColourToolStripMenuItem.Click ColorDialog1.Color = Me.TextBox1.BackColor ColorDialog1.ShowDialog() TextBox1.BackColor = ColorDialog1.Color End Sub

Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem.Click TextBox1.Undo() TextBox2.Undo() TextBox3.Undo() End Sub

Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) TextBox1.SelectAll()

69

Page 70: SD1046

TextBox2.SelectAll() TextBox3.SelectAll() End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick timeLabel16.Text = Now End Sub

Private Sub ToUppToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToUppToolStripMenuItem.Click

End Sub

Private Sub ToLowerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToLowerToolStripMenuItem.Click

End Sub

Private Sub FontSizeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontSizeToolStripMenuItem.Click

End Sub

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TextBox1.Text = Form1.daysTextBox6.Text NumericUpDown1.Value = NumericUpDown1.Value + 1 End Sub

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged Try If RadioButton1.Checked = True Then TextBox4.Text = CDbl(TextBox1.Text).ToString("C") Else TextBox4.Text = "" TextBox5.Clear() End If Catch ex As Exception MsgBox("Error! Calculate The Balance Amount") End Try End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim x As String If RadioButton1.Checked = True Then x = "Paid"

70

Page 71: SD1046

ElseIf RadioButton2.Checked = True Then x = "Part Payment" Else x = "Not Paid" End If Try query = New OleDb.OleDbCommand("insert into PAYMENT_TABLE(payment_id,client_name,amount_payable,profit_VAT,advert_charge_fee,payment_status,date_of_payment)values('" & NumericUpDown1.Value & "','" & ComboBox1.SelectedItem & "','" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & x & "','" & TextBox5.Text & "')", con) con.Open() query.ExecuteNonQuery() con.Close() MessageBox.Show("Record Saved") Catch ex As Exception MessageBox.Show("Record Not Saved") End Try End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.Close()

End Sub

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

End Sub

Private Sub Button5_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Me.Close() End Sub

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Form3.ShowDialog() Me.Refresh() End Sub

Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged

End Sub

Private Sub ToLeftToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToLeftToolStripMenuItem.Click

End Sub

Private Sub ToRightToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToRightToolStripMenuItem.Click TextBox1.TextAlign = HorizontalAlignment.Right End SubEnd Class

71

Page 72: SD1046

STAFF FORM

Imports System.Data.OleDbImports System.IO

Public Class Form4 Dim query As OleDb.OleDbCommand Public con As New System.Data.OleDb.OleDbConnection("provider= microsoft.jet.oledb.4.0; data source=" & Application.StartupPath & "\MVS.mdb;")

Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label16.Text = Now End Sub

Private Sub OPenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OPenToolStripMenuItem.Click Dim strfilename As String OpenFileDialog1.InitialDirectory = "c;\" OpenFileDialog1.Title = "open File" OpenFileDialog1.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*" OpenFileDialog1.ShowDialog() strfilename = OpenFileDialog1.FileName PictureBox1.Image = Image.FromFile(strfilename) OpenFileDialog1.Reset() End Sub

Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click SaveFileDialog1.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*" If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then PictureBox1.Image.Save(SaveFileDialog1.FileName) End If End Sub

Private Sub BackgroundColourToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackgroundColourToolStripMenuItem.Click ColorDialog1.Color = Me.RichTextBox1.ForeColor ColorDialog1.ShowDialog() RichTextBox1.ForeColor = ColorDialog1.Color End Sub

Private Sub FontColourToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontColourToolStripMenuItem.Click ColorDialog1.Color = Me.TextBox1.ForeColor ColorDialog1.ShowDialog()

72

Page 73: SD1046

TextBox1.ForeColor = ColorDialog1.Color End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() RichTextBox1.Clear() End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim x As String If RadioButton1.Checked = True Then x = "MALE" Else x = "FEMALE" End If Try query = New OleDb.OleDbCommand("insert into STAFF_TABLE(staff_id,first_name,middle_name,last_name,email,address,phone_no,dob,nationality,sex,reg_date)values('" & TextBox4.Text & "','" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox5.Text & "','" & RichTextBox1.Text & "','" & MaskedTextBox1.Text & "','" & TextBox6.Text & "','" & ComboBox4.Text & "','" & x & "','" & Label16.Text & "')", con) con.Open() query.ExecuteNonQuery() con.Close() MessageBox.Show("Record Saved") Catch ex As Exception MessageBox.Show("Record Not Saved") End Try End Sub

Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load File.SetAttributes(Application.StartupPath & "\MVS.mdb", FileAttributes.Hidden) Try Dim x As New DataSet Dim dr As DataRow Dim Z As DataTable Dim xyz As New OleDbDataAdapter("select * from STAFF_TABLE", con) xyz.Fill(x, "STAFF_TABLE") Z = x.Tables(0) ComboBox1.Items.Clear() For Each dr In Z.Rows ComboBox1.Items.Add(dr.Item("last_name")) Next Catch ex As Exception MsgBox("the database cannot be found. Try Again") End Try End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

73

Page 74: SD1046

Try Dim xyz As New OleDbCommand("SELECT * FROM STAFF_TABLE WHERE last_name = ('" & ComboBox1.SelectedItem & "')", con) Dim x As OleDbDataReader con.Open() x = xyz.ExecuteReader x.Read() TextBox4.Text = x.Item("staff_id") TextBox1.Text = x.Item("first_name") TextBox2.Text = x.Item("middle_name") TextBox3.Text = x.Item("last_name") TextBox5.Text = x.Item("email") RichTextBox1.Text = x.Item("address") MaskedTextBox1.Text = x.Item("phone_no") TextBox6.Text = x.Item("dob") ComboBox4.Text = x.Item("nationality") Label1.Text = x.Item("reg_date") con.Close() Catch ex As Exception MsgBox("ERROR") End Try

End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click Dim francis As String = "UPDATE STAFF_TABLE SET last_name =('" & TextBox3.Text & "'),first_name =('" & TextBox1.Text & "'),middle_name =('" & TextBox2.Text & "'),email =('" & TextBox5.Text & "'),phone_no =('" & MaskedTextBox1.Text & "'),dob =('" & TextBox6.Text & "'),nationality =('" & ComboBox4.SelectedItem & "'),staff_id =('" & TextBox4.Text & "'),reg_date =('" & Label11.Text & "'),address =('" & RichTextBox1.Text & "') WHERE last_name = ('" & TextBox3.Text & "')" Dim xyz As New OleDbCommand(francis, con) con.Open() xyz.ExecuteNonQuery() MsgBox("Staff Detail Is Updated") con.Close() End Sub

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

End Sub

Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem.Click

End Sub

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

End Sub

Private Sub OpenFileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenFileToolStripMenuItem.Click

74

Page 75: SD1046

End Sub

Private Sub SelectAllToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllToolStripMenuItem1.Click TextBox1.SelectAll() TextBox2.SelectAll() TextBox3.SelectAll() TextBox4.SelectAll() TextBox5.SelectAll() TextBox6.SelectAll() RichTextBox1.SelectAll() End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Try Dim x As String x = MessageBox.Show("Do You Want This Record Deleted From Database?", "CONFIRM DELETE", MessageBoxButtons.YesNo) If x = vbYes Then Dim xyz As New OleDbCommand("DELETE * FROM STAFF_TABLE WHERE last_name = ('" & ComboBox1.SelectedItem & "')", con) con.Open() xyz.ExecuteReader() MessageBox.Show("DELETED") con.Close() Else MessageBox.Show("NOT DELETED")

End If Catch ex As Exception MsgBox("ERROR") End Try End SubEnd Class

75