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
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
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
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
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
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
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
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
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
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
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
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
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
Fig 5.2.2.2: Error message for registering a password that is above 15 characters.
5.3 CUSTOMER FORM
11
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
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
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
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
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
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
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
Table 5.6.1: Objects and Properties of the Staff Form
26
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
Fig 5.6.2: screen shot of the staff form
28
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
'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
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
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
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
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
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
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
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
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