Professional Documents
Culture Documents
1. Introduction3 2. User requirements.3-4 3. Defining database for the system...4 4. System flow diagram of MVS advertisement system..5- 6 5.1 5.2 5.3 5.4 5.5 5.6 5.7 6 7 8 9 10 11
Login Form6- 8 Password Registration Form8- 11 Customer Form.11- 15 Advert Form...16- 20 Payment Form..21- 20 Staff Form..24- 28 Complains Form.......29- 30 System Setup and User Manual.....32- 33 My Role in the Visual Application.....33 Conclusion.34 References....35 Appendix..36-42 Source and Executable codes of the different forms...42- 75
LIST OF TABLES
1. Table 3.1: Forms and their corresponding tables in the systems 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 6. Table 5.3.1: Object and Properties of the customer form13- 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 form26 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 System12 7. Figure 5.3.2: Screen shot of the customer form15 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 form32
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. 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. 3
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 customers 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.
Table 3.1: Forms and their corresponding tables in the systems database
4.
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.
Splash screen
Login Form
Password Registration
MDI Form
Complain form
Customer form
Staff Form
Advert Form
Payment Form
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 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.
OK BUTTON 1
CANCEL
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.
NAME
FONT
SIZE
Size mode
LABEL
&username &Password
10 10 10 10
220,23 220,23 220,20 220,20 94,23 94,23 94,23 165,193 Stretch image
TEXTBOX
BUTTON logoPICTUREBOX
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.
ACTION-PSEUDOCODE Registers a valid user to the system Cancels the action of login
Enables 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 615 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.
5.2
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
USERNAMELABEL
PASSWORDLABEL
OK BUTTON
BACK BUTTON
5.2.1: Sketch of the Password registration form in MVS advert recording System
OBJECT
NAME
TEXT
BACK COLOR
FONT
SIZE
Sizemode
LOGINFORM 2
Loginform2 Username label Password label Label1 Username textbox Password textbox Textbox1 OK
Active Caption 10 10 10 10 10 10 64,23 64,23 90,13 180,20 180,20 180,20 91,23 91,23 165,193 Strechimage
LABEL
TEXTBOX
&OK &Cancel
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 OK_Click ACTION-PSEUDOCODE 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 Cancels the action of login
Cancel_Click TextBox1_TextChanged
Checks 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
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
LABEL 10
TEXTBOX 1 TEXTBOX 2
TEXTBOX 3
TEXTBOX 4
LABEL 13
RICHTEXTBOX 1
TEXTBOX 5
DATETIMEPICKER 1
MASKEDTEXTBOX 1
GROUPBOX 2
TEXTBOX 6
COMBOBOX 4
COMBOBOX 1
GROUPBOX 1
BUTTON 2 BUTTON 3 BUTTON 4
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.
COMBOBOX 2
LABEL 9
NumericUpdown 1
LABEL 15
PICTURE BOX 1
MENU BAR
LABEL 14
LABEL 6
LABEL 7
LABEL 11
LABEL 4
LABEL 8
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.
NAME Form 3 Label 10 Label 9 Label14 Label2 Label3 Label4 Label13 Label5 Label16 Label6 Label7 Label11 Textbox1 Textbox2 Textbox3 Textbox4 Textbox5 Textbox6 Button5 Button6 Button7 Button1 Button2 Button3 Button4 Combobo2 Combobo4 Combobo1
TEXT Customer Form Multi Vision Services Malaysia No 2, Jalan Kempumg, Nilai Malaysia Customer Details First Name Middle Name Last Name Email Address Received Phone Date of birth Nationality
FORE COLOR
FONT
SIZE
Linen Blue
14 9 12 10 10 10 10 10 10 10 10 10
364,24 256,15 75,18 91,18 75,18 44,18 61,18 69,18 75,18 82,18 73,18 75,18 239,22 239,22 239,22 239,22 100,20 239,20 75,24 75,24 75,24 63,27 75,23 75,23 75,23 137,21 170,23 101,26 239,20 Drop down List
LABELS
TEXTBOX
BUTTONS
COMBO BOX
Masked Textbox
MaskedTex tbox1
13
GROUP BOX
Groupbox1
Sex
122,59
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
Button5_Click Button6_Click Button7_Click Button1_Click ComboBox4_SelectedIndexChanged ComboBox1_SelectedIndexChanged_1 Button2_Click Button3_Click Button4_Click DateTimePicker1_ValueChanged
ACTIONS-PSEUDOCODE
Searches data from the database Deletes data from the Database Updates data and re-save it to database Shows the customer database in grid view Provides a list of Countries to be selected from Provides a list showing gender(sex) Clears text in textboxes, maskedtexboxes and Richtextboxes Switch user from the present form to the next form Saves the data on the present form to the database of that form Selects the date customer visited from the Calendar Displays current time and Date on a label
Timer1_Tick
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
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
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 informations 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 Advert Form FORE COLOR LABEL7
LABEL7
FONT
READ ONLY
SIZE
MENU BAR
Advert PICTURE Form1 Details BOX 1 Label 18 LABEL Label 17 LABEL 1 Label 11 LABEL 2 Label 12 Label1 Label 2 LABELLabel 16 16 Label 3 LABEL 3 Label 6 Label 5 LABEL 6 Label 4 Label 7 LABEL 5 Label 8 Label 13 LABEL 4 Label 14 Label 15 LABEL 7 Label 19
Multi Vision 14 364,24 Textbox 1 LABEL 12 Services Malaysia No 2, Jalan Blue 9 256,15 RICHTEXTBOX1 Kempumg, Nilai Malaysia GROUPBOX 1 Advert ID 10 63,16 ADVCOMBOBOX 1 TEXTBOX 4 Customer ID 10 81,16 Advert Description 10 120,18 COMBOBOX 3 Advert Category 10 108,18 DATETIMPICKER 2 Received 10 69,18 TEXTBOX 3 To Appear 10 75,18 BUTTON 5 DATETIMPICKER 1 Timing 10 118,18 DTPTEXTBOX 5 Period 10 50,18 BUTTON 7 TEXTBOX 2 Label 15 When 2 10 45,18 DurCOMBOBOX No of Days Where Amount Payable /minute perCOMBOBOX 4
whenCOMBOBOX 3
LABEL 11
MyNUMERICUPDOWN 1
10 10 LABEL 9 10
Label 19
Minutes COMBOBOX 2 Days calculate Clear Continue DaysTEXTBOX 6 Save Search BUTTON 1 Delete Update View database
COMBOBOX 1
Button1 LABEL 8 Button2 LABELButton3 13 BUTTONS Button4 Button5 BUTTON 2 Button6 Button7 Button8 ADVCombo box1 Combobox2 DurCombo
10 10 10
16
COMBO BOX
box2 WhenCombo box3 Percombo Box 4 Combo box 1 Combo box 3 Textbox1 Textbox2 Textbox3 DTPTextbox5 Textbox4 Daystextbox6 GroupBox1 GroupBox2 Richtextbox1
216,21
324,82
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 forms 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
ComboBox1_SelectedIndexChanged DateTimePicker2_ValueChanged DateTimePicker1_ValueChanged ComboBox2_SelectedIndexChanged whenComboBox3_SelectedIndexChanged perComboBox4_SelectedIndexChanged ComboBox2_SelectedIndexChanged_1 ComboBox1_SelectedIndexChanged_1
ACTION-PSEUDOCODE
Provides a list of advert category Displays the present date on a textbox from the calendar Displays the date the advert should be aired on a textbox from the calendar Displays the timing (minutes) of the advert Displays when you want the advert to be aired Display the period of time the advert is to be aired per day Displays the number of days the advert is to be shown Displays the region in which the advert is to be shown
17
Clears textboxes and richtextboxes in the present form Calculates the amount payable by the customer Search record from database about a particular advert and display it in the current form Shows the advert database in gird view on a new window Deletes unwanted advert record from database Saves an edited record to database. Saves the data on the present form into the database. Moves from the present form to the next form Moves the counter from zero to the required number
The screen short of the advert form as seen in Figure 5.4.2 above has eight buttons, all performing different important functions.
18
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 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.
19
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.
20
Fig
COMBOBOX 1
LABEL 1 MENU BAR
PICTURE BOX 1
LABEL 2
NUMERICUPDOWN 1
LABEL 13
TEXTBOX 4
LABEL 2 LABEL 3
LABE L 4
Datetimepicker1
LABEL 5
TEXTBOX 3
BUTTON 3
BUTTON 2
BUTTON 4
GROUPBOX 2
TimeLABEL 16
. 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
Label2 Label3 Label4 Label5 Label1
Text
Client Amount Payable VAT Balance Multi Vision Services Malaysia
Back Colour
Active caption Active caption Active caption Active caption Active caption
Fore Colour
Font
10 (Bold) 10 (Bold) 10 (Bold) 10 (Bold) 14 (Bold)
Size
43,18 112,18 37,17 60,18 364,24
Read only
Linen
21
Label12
Active caption Active caption Active caption Active caption Active caption
Blue
256,15
Label 6 LABEL Label 7 Label13 Label 16 Button2 Button3 Button1 Button4 Button5 Textbox1 Textbox2 Textbox3 Textbox4 Textbox5 Picturebox1 Timelabel16 Combobox1
BUTTON
164,22 164,22 164,22 98,22 98,22 Company Logo RED 164,21 140,95
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
NumericUpDown1_ValueChanged ComboBox1_SelectedIndexChanged DateTimePicker1_ValueChanged Button6_click Button2_Click
ACTION-PSEUDOCODE
Displays the form number from Displays the client in which the advert came from Displays the date the money was paid from the calendar Opens the payment database in a new window Calculates the balance and the profit MVS will derive from that particular advert.
22
Clears the fields in the present form redirects user to the previous form Saves the data on the present form to the database Closes the 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, 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
23
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 staffs or employees (new and old) information of MVS. The properties and objects of the Staff form are presented in Table 5.6.1.
24
LABEL 1
TEXTBOX 1 TEXTBOX 2
TEXTBOX 3 TEXTBOX 4
RICHTEXTBOX 1
MASKEDTEXTBOX 1 TEXTBOX 6
LABEL 8
COMBOBOX 4
LABEL 16 BUTTON 2 BUTTON 3
Object
Name
Text
Auto Size
Fore Colour
Font
Tab index
Staff Details
Form 4
Staff Form
COMBOBOX 2
LABEL 12
LABEL 2
Radio button 1 Radio button 2
PICTURE BOX 1
MENU BAR
LABEL 13
LABEL 15
LABEL 14
LABEL 11
LABEL 3
LABEL 4
LABEL 7
LABEL 5 LABEL 6
GROUPBOX 1
BUTTON 5
GROUPBOX 2
Size
Back colour
Active Caption
25
Label1
Label12 Label2 Label5 Label3 Label4 Label13 Label6 Label15 Label14 Label7 Label11 Label16 Textbox1 Textbox2 Textbox3 Textbox4 Textbox5 Textbox6 Picture box1 Masked textbox1 Combo Box1 COMBO BOX Combo Box4 Button2 Button3 Button1 BUTTON Button 5 Button 6 Button 7 Group box1 Group Box2
LABELS
Multi Vision Services Malaysia No 2, Jalan Kempumg, Nilai Malaysia Staff Details First Name Middle Name Last Name Staff ID Email Address Phone No Date of Birth Nationality False
Linen
14 Bold 9 12 10 10 10 10 10 10 10 10 10 12
364,24
Blue BLUE
256,15 79,16 75,18 91,18 75,18 55,18 44,18 61,18 73,18 82,18 73,18 116,52 239,21 239,21 239,21 239,21 239,21 239,21 140,95 239,22
6 7
RED
1 2 3 4 5 8 Company Logo
9 Clear Save View Database Search Update Delete Sex Access database 10 10 10 10 10 10
164,23 75,23
122,92
GROUP BOX
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. 26
PROCEDURE
Button5_click Button2_Click Button6_click Button7_click Button3_Click Button1_Click ComboBox4_SelectedIndexChanged Combobox1_SelectedIndexchanged Form4_load
ACTION-PSEUDOCODE
Search record from database and display in the form Clears textboxes and rich textboxes in the present form Deletes a Staff record from database Saves an edited record to the database Saves the information on the present form into the database Opens the staff table of the database in a new window in datagridview Provides a list of countries to be chosen from Provides a drop dawn list of staffs last names to enable user search, update or delete record from database. Pulls all staff records saved in database to a combo box to enable search using last name
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
28
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.
PICTURE BOX 1
LABEL 2
LABEL 12
TEXTBOX 1
RADIOBUTTON 1
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
RADIOBUTTON 2 RADIOBUTTON 3
DATETIMEPICKER 1
RICHTEXTBOX 1
COMBOBOX
BUTTON 5
TEXTBOX 6
BUTTON 7 BUTTON 6
BUTTON 2
BUTTON 3
GROUPBOX 2
LABEL 11
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.
Name
Text
Fore Colour
Font
Size
Border Style
Back colour
LABEL
Label2 Label11 Button1 Button2 Button3 Button 4 Button 5 Button 6 Button 7 Groupbox1 Groupbox2 Groupbox3 Textbox 1 Textbox 4 Textbox 5 Textbox 6
Complain Form Customer Name Advert Category Received Date Supposed Date Complain Staff No No 2, Jalan Kempumg, Nilai Malaysia Multi Vision Services Malaysia
Active Caption 10 10 10 10 10 Blue Linen Red 9 14 12 107,18 107,18 101,18 105,18 67,18 75,18 256,15 364,24 120,56 75,23 75,23 75,23 3D
BUTTON
GROUP BOX
Clear Save Exit View Database Search Delete Update Complain Status Access Database 10 10 10 10
TEXT BOX
Combobox1 Combobox3 Date time Picker1 Date time Picker2 10 10 110 10 Resolved Still in process Not yet attended to 289,24 137,22 137,22 382,96
RICHTEX TBOX
RADIO BUTTON
30
The table below is the event and procedures of the complain form in the Advert Recording System.
PROCEDURE
ComboBox1_SelectedIndexChanged DateTimePicker1_ValueChanged DateTimePicker2_ValueChanged GroupBox1_Enter Button1_Click Button2_Click Button3_Click Button4_click Button5_click Button6_clik Button7_click
ACTION-PSEUDOCODE
Displays the advert category Displays the received date of the advert Displays the supposed date of the advert Displays the options available for complain status Clears textboxes and Rich textboxes in the present form Saves the data on the present form into the database Exits from the present form Opens the Complains table of the database in grid view Search a complain record from database and display it in the form Deletes a record from database Saves an Edited record to database.
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
6.
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
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.
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
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
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-CharactersIpzuVc0X.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, OReilly 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/ErrorProvider10 062009074936AM/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, OReilly & 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
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, OReilly 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, AddisonWesley: 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, lets 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 before advert category.
Fig 2b: error message when period field is Filled before timing
2c:
when
. 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.
Advert category
SPORTS FUNERAL HEALTH EDUCATION ECONOMIC COMMERCIAL FASHION AND DESIGN ENTERTAINMENT
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 (II) Morning and advert category X the no of minutes the advert will last for each broadcast. The period ( (I) Morning, Afternoon, Evening, 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: lets 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.
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 datas 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.
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
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
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.OleDb Imports 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 Sub End Class
45
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 Sub End Class
47
ADVERT FORM
Imports system.Data.OleDb Imports System.IO Public 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
Then
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 Sub End Class
55
COMPLAIN FORM
Imports System.Data.OleDb Imports 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_da te,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 Sub End Class
60
CUSTOMER FORM
Imports System.Data.OleDb Imports 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,pho ne_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 Sub End Class
67
PAYMENT FORM
Imports System.Data.OleDb Imports System.IO Public 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 Sub End Class
71
STAFF FORM
Imports System.Data.OleDb Imports 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,p hone_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
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
Try
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 Sub End Class
75