- The way I found to stop this from happening was telling the program what is suppose to be on each combo box and if the programs finds something that has not been specified on the code a message box will be display to the user telling them that the information he/she just enter is incorrect.
- The code for the course code combo box is the following;
If coursecode.Text = "ZHMMMX1A" Or coursecode.Text = "HCCISX0A" _
Or coursecode.Text = "HCCISE1A" Or coursecode.Text = "HCCISE2A" Or _
coursecode.Text = "select course code" Then
Else
coursecode.Text = "select course code"
MsgBox ("NO OTHER INFORMATION CAN BE ENTER, PLEASE SELECT A COURSE CODE FROM THE LIST"), (vbCritical)
Exit Sub
End If
- The code for the day combo box is the following;
If comboday.Text = "01" Or comboday.Text = "02" Or comboday.Text = "03"
Or comboday.Text = "04" Or comboday.Text = "05" Or comboday.Text =
"06" Or comboday.Text = "07" Or comboday.Text = "08" Or comboday.Text _="09" Or comboday.Text = "10" Or comboday.Text = "11" Or
comboday.Text = "12" Or comboday.Text = "13" Or
Or comboday.Text = "15" Or comboday.Text = "16" Or comboday.Text =
=comboday.Text = "14" or "17" Or comboday.Text = "18" Or comboday.Text = "19" Or comboday.Text = "20" Or comboday.Text = "21" Or comboday.Text = "22" Or comboday.Text = "23" Or comboday.Text = "24" Or comboday.Text = "25" Or _ comboday.Text = "26" Or comboday.Text = "27" Or comboday.Text = "28" Or _ comboday.Text = "29" Or comboday.Text = "30" Or comboday.Text = "31" Then
Else: MsgBox (" NO OTHER INFORMATION CAN BE ENTER, PLEASE SELECT A DAY FROM THE LIST FROM THE LIST"), (vbCritical)
comboday.Text = "DAY"
Exit Sub
End If
- The code for the month combo box is the following;
If combomonth.Text = "01" Or combomonth.Text = "02" Or combomonth.Text = "03" _
Or combomonth.Text = "04" Or combomonth.Text = "05" Or combomonth.Text = "06" _
Or combomonth.Text = "07" Or combomonth.Text = "08" Or combomonth.Text = "09" _
Or combomonth.Text = "10" Or combomonth.Text = "11" Or combomonth.Text = "12" Then
Else: MsgBox ("NOT NEW INFORMATION CAN BE ENTERED, PLEASE SELECT ONE OF THE MONTH ON THE LIST"), (vbCritical)
combomonth.Text = "MONTH"
Exit Sub
End If
- The code for the year combo box is the following:
If comboyear.Text = "2003" Or comboyear.Text = "2004" Or comboyear.Text = "2005" _
Or comboyear.Text = "2006" Or comboyear.Text = "2007" Then
Else: MsgBox ("NOT NEW INFORMATION CAN BE ENTERED, PLEASE SELECT ONE OF THE YEARS OF THE LIST"), (vbCritical)
comboyear.Text = "YEAR"
Exit Sub
End If
- The code for the start time combo box is the following;
If Combohour.Text = "08:00 AM" Or Combohour.Text = "08:15 AM" Or Combohour.Text = "08:30 AM" _
Or Combohour.Text = "08:45 AM" Or Combohour.Text = "09:00 AM" Or Combohour.Text = "09:15 AM" _
Or Combohour.Text = "09:30 AM" Or Combohour.Text = "09:45 AM" Or Combohour.Text = "10:00 AM" _
Or Combohour.Text = "10:15 AM" Or Combohour.Text = "10:30 AM" Or Combohour.Text = "10:45 AM" _
Or Combohour.Text = "11:00 AM" Or Combohour.Text = "11:15 AM" Or Combohour.Text = "11:30 AM" _
Or Combohour.Text = "11:45 AM" Or Combohour.Text = "12:00 PM" Or Combohour.Text = "12:15 PM" _
Or Combohour.Text = "12:30 PM" Or Combohour.Text = "12:45 PM" Or Combohour.Text = "13:00 PM" _
Or Combohour.Text = "13:15 PM" Or Combohour.Text = "13:30 PM" Or Combohour.Text = "13:45 PM" _
Or Combohour.Text = "14:00 PM" Or Combohour.Text = "14:15 PM" Or Combohour.Text = "14:30 PM" _
Or Combohour.Text = "14:45 PM" Or Combohour.Text = "15:00 PM" Or Combohour.Text = "15:15 PM" _
Or Combohour.Text = "15:30 PM" Or Combohour.Text = "15:45 PM" Or Combohour.Text = "16:00 PM" _
Or Combohour.Text = "16:15 PM" Or Combohour.Text = "16:30 PM" Or Combohour.Text = "16:45 PM" _
Or Combohour.Text = "17:00 PM" Or Combohour.Text = "17:15 PM" Or Combohour.Text = "17:30 PM" _
Or Combohour.Text = "17:45 PM" Or Combohour.Text = "18:00 PM" Or Combohour.Text = "18:15 PM" _
Or Combohour.Text = "18:30 PM" Or Combohour.Text = "18:45 PM" Or Combohour.Text = "19:00 PM" _
Or Combohour.Text = "19:15 PM" Or Combohour.Text = "19:30 PM" Then
Else
Combohour.Text = ""
MsgBox ("NOT INFORMATION CAN BE ENTERED, PLEASE SELECT ANY HOUR ON THE LIST"), (vbCritical)
Exit Sub
End If
- The code for the finish time combo box is the following:
If Combohours.Text = "09:00 AM" Or Combohours.Text = "09:15 AM" Or Combohours.Text = "09:30 AM" _
Or Combohours.Text = "09:45 AM" Or Combohours.Text = "10:00 AM" Or Combohours.Text = "10:15 AM" _
Or Combohours.Text = "10:30 AM" Or Combohours.Text = "10:45 AM" Or Combohours.Text = "11:00 AM" _
Or Combohours.Text = "11:15 AM" Or Combohours.Text = "11:30 AM" Or Combohours.Text = "11:45 AM" _
Or Combohours.Text = "12:00 AM" Or Combohours.Text = "12:15 AM" Or Combohours.Text = "12:30 AM" _
Or Combohours.Text = "12:45 AM" Or Combohours.Text = "13:00 PM" Or Combohours.Text = "13:15 PM" _
Or Combohours.Text = "13:30 PM" Or Combohours.Text = "13:45 PM" Or Combohours.Text = "14:00 PM" _
Or Combohours.Text = "14:15 PM" Or Combohours.Text = "14:30 PM" Or Combohours.Text = "14:45 PM" _
Or Combohours.Text = "15:00 PM" Or Combohours.Text = "15:15 PM" Or Combohours.Text = "15:30 PM" _
Or Combohours.Text = "15:45 PM" Or Combohours.Text = "16:00 PM" Or Combohours.Text = "16:15 PM" _
Or Combohours.Text = "16:30 PM" Or Combohours.Text = "16:45 PM" Or Combohours.Text = "17:00 PM" _
Or Combohours.Text = "17:15 PM" Or Combohours.Text = "17:30 PM" Or Combohours.Text = "17:45 PM" Or Combohours.Text = "18:00 PM" Or Combohours.Text = "18:15 PM" _
Or Combohours.Text = "18:30 PM" Or Combohours.Text = "18:45 PM" Or Combohours.Text = "19:00 PM" _
Or Combohours.Text = "19:15 PM" Or Combohours.Text = "19:30 PM" Or Combohours.Text = "19:45 PM" _
Or Combohours.Text = "20:00 PM" Or Combohours.Text = "20:15 PM" Or Combohours.Text = "20:30 PM" _
Or Combohours.Text = "21:00 PM" Then
Else
Combohours.Text = ""
MsgBox ("NOT INFORMATION CAN BE ENTERED, PLEASE SELECT ANY HOUR ON THE LIST"), (vbCritical)
Exit Sub
End If
- The print out is not easy to read, the layout is all wrong and the user will not understand it.
- On my print out there were no spaces between words or number for example I want the name to be all on one line but with the code I am using right now the name will look like this:
CarlosMontoya.
The date will look like this:
50012004
I want to create spaces between the lines and I want to insert things like,
Name, course code, room number, start time etc next to a just above the appropriate information.
I also want the user to be able to see the number of computer and the software available in the room he or she is booking. To achieve this I must create an if statement if…..then…..end if
Printer.print; vbcrlf is use as one line space on text file.
+ “ “ + is use as a space between words or number.
I also declare where I want to use bold words using false or true.
A message box before printing, the message box will remind the user to save or the information will not be process.
The code I will use:
MsgBox "DO NOT FORGET TO SAVE OR YOUR REQUEST WILL NOT BE PROCESS"
Printer.CurrentX = 4400
Printer.CurrentY = 1440
Printer.FontName = "ARIAL"
Printer.FontSize = "15"
Printer.FontUnderline = True
Printer.Print "BOOKING INFORMATION"
Printer.FontSize = 10
Printer.Print ; vbCrLf
Printer.Print ; vbCrLf
Printer.FontUnderline = False
Printer.FontBold = False
Printer.Print "///////////////////////////////////////////////////////////////////////////////////////////"
Printer.Print ; vbCrLf
Printer.Print ; vbCrLf
Printer.Print "//////////////////////////////////////////////////////////////////////////////////////////"
Font.Size = 28
Printer.FontBold = True
Printer.Print ; vbCrLf
Printer.Print Date
Printer.FontBold = False
Printer.Print ; vbCrLf
Font.Size = "22"
Printer.FontBold = True
Printer.Print " NAME: "
Printer.FontBold = False
Printer.Print ; TextNAME.Text + " " + TextSURNAME.Text
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print " COURSE CODE: "
Printer.FontBold = False
Printer.Print ; coursecode.Text
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print "ROOM NUMBER: "
Printer.FontBold = False
Printer.Print ; roomnumber.Text
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print "DATE: "
Printer.FontBold = False
Printer.Print ; comboday.Text + " " + combomonth.Text + " " + comboyear.Text
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print "FROM: "
Printer.FontBold = False
Printer.Print ; Combohour.Text
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print "TO: "
Printer.FontBold = False
Printer.Print ; Combohours.Text
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print "NUMBER OF COMPUTER AVAILABLE"
Printer.Print ; vbCrLf
Printer.FontBold = False
If roomnumber.Text = "T100" Then
Printer.Print "25 COMPUTERS"
End If
If roomnumber.Text = "T229" Then
Printer.Print "25 COMPUTERS"
End If
If roomnumber.Text = "T201" Then
Printer.Print "25 COMPUTERS"
End If
If roomnumber.Text = "T232" Then
Printer.Print "25 COMPUTERS"
End If
If roomnumber.Text = "T217" Then
Printer.Print "25 COMPUTERS"
End If
If roomnumber.Text = "T212" Then
Printer.Print "20 COMPUTERS"
End If
If roomnumber.Text = "T211" Then
Printer.Print "20 COMPUTERS"
End If
If roomnumber.Text = "T221" Then
Printer.Print "20 COMPUTERS"
End If
If roomnumber.Text = "T227" Then
Printer.Print "25 COMPUTERS"
End If
If roomnumber.Text = "T223" Then
Printer.Print "15 COMPUTERS"
End If
If roomnumber.Text = "T152" Then
Printer.Print "15 COMPUTERS"
End If
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print "SOFTWARE AVAILABLE: "
Printer.FontBold = False
If roomnumber.Text = "T100" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T229" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T201" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T232" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T217" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T212" Then
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T211" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
End If
If roomnumber.Text = "T221" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
End If
If roomnumber.Text = "T227" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T223" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T152" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
Printer.Print ; vbCrLf
Printer.Print "///////////////////////////////////////////////////////////////////////////////////////////"
Printer.Print ; vbCrLf
Printer.Print ; vbCrLf
Printer.Print "//////////////////////////////////////////////////////////////////////////////////////////"
Printer.EndDoc
Close #1
- I want the user to be able to see the date.
- I did this a through a label as I already have a timer I just add a line of code to the timer and that will show the label with the time on the interface.
The piece of code I am going to use is:
LBLDATE1.Caption = Format$(Date, "d - mm - yyyy")
- I wan the user to be able to see the time.
- I will do the same I did with the date but format it as a the time
The piece of code I am going to use is:
lbltime.Caption = Format$(Time, "HH:MM")
- The information the user is entering into the system is not appearing on the bookinfo list box.
- To solve this problem I used a code to add item on the list box call bookinfo, this code will be place on all the command button the user is more likely to use.
The code is the following:
BOOKINFO.Clear
BOOKINFO.AddItem "NAME: " + TextNAME.Text + " " + TextSURNAME
BOOKINFO.AddItem "COURSE CODE: " + coursecode.Text
BOOKINFO.AddItem "ROOM NUMBER: " + roomnumber.Text
BOOKINFO.AddItem "DATE: " + comboday.Text + " " + combomonth + " " + comboyear
BOOKINFO.AddItem "FROM: " + Combohour.Text
BOOKINFO.AddItem "TO: " + Combohours.Text
BOOKINFO.AddItem "NUMBER OF COMPUTER AND SOFTWARE AVAILABLE: "
- There is not message box that ask the user if the information they enter is correct.
- All I have to do to achieve this is a message box with ok and a cancel button, this code will be place on the print command and the save command.
The code I am going to use is the following:
If MsgBox("IS THIS INFORMATION CORRECT?" + vbCrLf + _
"NAME: " + TextNAME.Text + " " + TextSURNAME.Text _
+ vbCrLf + " COURSE CODE: " + coursecode.Text _
+ vbCrLf + " ROOM NUMBER: " + roomnumber.Text _
+ vbCrLf + "DATE: " + comboday.Text + " " + combomonth + " " + comboyear.Text _
+ vbCrLf + "FROM: " + Combohour _
+ vbCrLf + "TO: " + Combohours, vbOKCancel, _
"Save Record") = vbOK Then
Dim filenumber As Integer
filenumber = 1
Open "C:\BOOKING INFORMATION.TXT" For Append As #1
Print #1, vbCrLf
Print #1, " THIS ROOM HAS BEEN BOOKED"
Print #1, Date
Call Shell("NOTEPAD.EXE C:\BOOKING INFORMATION.TXT")
End if
- I do not think I need the information command button to find out what rooms are available with a course code.
- The way to remove the information command button without altering the process of the program will be by creating four if ….then…elseif…..end if statements as a click event, that way when the user selects a course code that will automatically show all the rooms number available .
The code to do this is the following:
Private Sub coursecode_Click()
If coursecode.Text = "HCCISX0A" Then HCCISX04
rooms1.Clear
rooms1.AddItem "T100"
Rooms1.AddItem "T229"
rooms1.AddItem "T201"
rooms1.AddItem "T232"
ElseIf coursecode.Text = "ZHMMMX1A" Then
rooms1.Clear
rooms1.AddItem "T100
rooms1.AddItem "T229"
rooms1.AddItem "T201"
rooms1.AddItem "T232"
ElseIf coursecode.Text = "HCCISE1A" Then
rooms1.Clear '
rooms1.AddItem "T217"
rooms1.AddItem "T212"
rooms1.AddItem "T211"
rooms1.AddItem "T221"
rooms1.AddItem "T100"
rooms1.AddItem "T229"
rooms1.AddItem "T201"
rooms1.AddItem "T232"
ElseIf coursecode.Text = "HCCISE2A" Then
rooms1.Clear
rooms1.AddItem "T227"
rooms1.AddItem "T223"
rooms1.AddItem "T152”
End IF
End Sub
- I found a problem if the user wants to make a new booking.
If the same user or a new user wants to make a new booking there is a problem the code for a new booking is:
Private Sub cmdreset_Click
Coursecode.text = “select course code”
Roomnumber.text = “”
textNAME.text = “”
textSURNAME.text = “”
comboday.text = “DAY”
combomonth.text = “MONTH”
comboyear.text = “YEAR”
combohour.text = “”
combohours.text = “”
BOOKINFO.clear
Rooms1.clear
Des1.clear
Coursecode.SetFocus
End Sub
After the user has clicked the new booking command all the message boxes that tell the user that there is some information missing stop working.
It looks like the program is looking for some kind of character on the text boxes and combo boxes.
The way that I stop this from happening is by reviewing the code to check all the information has been enter, the old codes is:
If roomnumber.Text = "" Then
MsgBox ("PLEASE ENTER A ROOM NUMBER"), (vbCritical)
End If
The new code that I am going to use on this project is:
If len(roomnumber.Text )= 0 Then
MsgBox ("PLEASE ENTER A ROOM NUMBER"), (vbCritical)
Exit sub
End If
This code means that if the characters on the room number text box is equal to zero then show a message box asking the user to select a room number.
Including the Exit Sub just before the End If, as I explained before this will stop the message boxes appearing one after the other.
- There should be a drop down menu on the form.
looking at my gesign I see that I drop down menu would make look nicer but at the same time it would help the user if he wants to use any of those commands.
The best way I found to do this by going to the toolbar menu on the visual basic program and find Menu Edito in there you write the mane and the caption you want to see the user to see.
It is very important to give meanfully names to this commands and the same thing with the all the other control on our application.
The code for the drop down menu call File is the fowilling:
Private Sub MDLOAD_Click()
BOOKING_SYSTEM!cmdload = True
End Sub
Private Sub MDPRINT_Click()
BOOKING_SYSTEM!cmdprint = True
End Sub
Private Sub MDRESET_Click()
BOOKING_SYSTEM!cmdreset = True
End Sub
Private Sub MDSAVE_Click()
BOOKING_SYSTEM!cmdsave = True
End Sub
And the codes from the drop down menu call About is the following:
Private Sub MDRESET_Click()
BOOKING_SYSTEM!cmdreset = True
End Sub
Private Sub MDSAVE_Click()
BOOKING_SYSTEM!cmdsave = True
End Sub
FINAL CODES
- CODES OR PROCESS FOR THE coursecode COMBO BOX
Private Sub coursecode_Click()
If coursecode.Text = "HCCISX0A" Then
rooms1.Clear
rooms1.AddItem "T100"
rooms1.AddItem "T229”
rooms1.AddItem "T201"
rooms1.AddItem "T232"
ElseIf coursecode.Text = "ZHMMMX1A" Then
rooms1.Clear '
rooms1.AddItem "T100"
rooms1.AddItem "T229"
rooms1.AddItem "T201"
rooms1.AddItem "T232"
ElseIf coursecode.Text = "HCCISE1A" Then
rooms1.Clear
rooms1.AddItem "T217"
rooms1.AddItem "T212"
rooms1.AddItem "T211"
rooms1.AddItem "T221"
rooms1.AddItem "T100"
rooms1.AddItem "T229"
rooms1.AddItem "T201"
rooms1.AddItem "T232"
ElseIf coursecode.Text = "HCCISE2A" Then
rooms1.Clear
rooms1.AddItem "T227"
rooms1.AddItem "T223 .
rooms1.AddItem "T152"
End If
End Sub
Private Sub rooms1_Click()
roomnumber.Text = rooms1.Text
End Sub
- CODES IN THE roomnumber TEXT BOX
THIS CODE IS TO SHOW THE NUMBER OF COMPUTERS 'THE SOFTWARE INSTALL ON THOSE COMPUTERS AND THE SOFTWARE INSTALL ON THOSE COMPUTERS.
Private Sub roomnumber_Change()
If roomnumber.Text = "T100" Then
des1.Clear
des1.AddItem "25 COMPUTERS"
des1.AddItem "VISUAL BASIC 6.0"
des1.AddItem "SELECT"
des1.AddItem "FLASH"
End If
If roomnumber.Text = "T229" Then
des1.Clear
des1.AddItem "25 COMPUTERS"
des1.AddItem "VISUAL BASIC 6.0"
des1.AddItem "SELECT"
des1.AddItem "FLASH"
End If
If roomnumber.Text = "T201" Then
des1.Clear
des1.AddItem "25 COMPUTERS"
des1.AddItem "SELECT"
des1.AddItem "FLASH"
des1.AddItem "VISUAL BASIC”
End If
If roomnumber.Text = "T232" Then
des1.Clear
des1.AddItem "25 COMPUTERS"
des1.AddItem "FLASH"
des1.AddItem "VISUAL BASIC"
des1.AddItem "SELECT"
End If
If roomnumber.Text = "T217" Then
des1.Clear
des1.AddItem "20 COMPUTERS"
des1.AddItem "VISUAL BASIC 6.0"
des1.AddItem "SELECT"
des1.AddItem "FLASH"
End If
If roomnumber.Text = "T212" Then
des1.Clear
des1.AddItem "20 COMPUTERS"
des1.AddItem "SELECT"
des1.AddItem "FLASH"
End If
If roomnumber.Text = "T211" Then
des1.Clear
des1.AddItem "20 COMPUTERS"
des1.AddItem "VISUAL BASIC 6.0"
des1.AddItem "SELECT"
End If
If roomnumber.Text = "T221" Then
des1.Clear
des1.AddItem "20 COMPUTERS"
des1.AddItem "VISUAL BASIC 6.0"
End If
If roomnumber.Text = "T227" Then
des1.Clear
des1.AddItem "15 COMPUTERS"
des1.AddItem "VISUAL BASIC 6.0"
des1.AddItem "SELECT"
des1.AddItem "FLASH"
End If
If roomnumber.Text = "T223" Then
des1.Clear
des1.AddItem "15 COMPUTERS"
des1.AddItem "VISUAL BASIC 6.0"
des1.AddItem "SELECT"
des1.AddItem "FLASH"
End If
If roomnumber.Text = "T152" Then
des1.Clear
des1.AddItem "15 COMPUTERS"
des1.AddItem "VISUAL BASIC 6.0"
des1.AddItem "SELECT"
des1.AddItem "FLASH"
End If
End Sub
-
CODES IN THE cmdsave, cmdload, cmdprint COMMAND BUTTON
- Codes to check that all the information has been entered correctly
Private Sub cmdsave_Click()
If Len(coursecode.Text) = 0 Then
MsgBox ("PLEASE ENTER COURSE CODE"), (vbCritical)
Exit Sub
End If
If coursecode.Text = "select course code" Then
MsgBox ("PLEASE ENTER COURSE CODE"), (vbCritical)
Exit Sub
End If
If coursecode.Text = "ZHMMMX1A" Or coursecode.Text = "HCCISX0A" _
Or coursecode.Text = "HCCISE1A" Or coursecode.Text = "HCCISE2A" Or _
coursecode.Text = "select course code" Then
Else
coursecode.Text = "select course code"
MsgBox ("NO OTHER INFORMATION CAN BE ENTER, PLEASE SELECT A COURSE CODE FROM THE LIST"), (vbCritical)
Exit Sub
End If
If Len(roomnumber.Text) = 0 Then
MsgBox ("PLEASE SELECT A ROOM NUMBER FROM THE LIST"), (vbCritical)
Exit Sub
End If
If Len(TextNAME.Text) = 0 Then
MsgBox ("PLEASE ENTER YOUR NAME"), (vbCritical)
TextNAME.SetFocus
Exit Sub
End If
If Len(TextSURNAME.Text) = 0 Then
MsgBox ("PLEASE ENTER YOUR SURNAME"), (vbCritical)
TextSURNAME.SetFocus
Exit Sub
End If
TO CHECK THAT THE USER DOES NOT ENTER AN INVALID DATE TO BOOKED A ROOM
If Val(comboday.Text) < Val(lblday.Caption) And Val(combomonth.Text) _
<= Val(lblmonth.Caption) _
Or Val(comboday.Text) = Val(lblday.Caption) And _
Val(combomonth.Text) < Val(lblmonth.Caption) _
Or Val(combomonth.Text) < Val(lblmonth.Caption) _
And Val(comboday.Text) < Val(lblday.Caption) Then
MsgBox "WRONG DATE ENTERED, PLEASE TRY AGAIN"
Exit Sub
End If
If comboday.Text = "DAY" Or comboday.Text = "" Or combomonth.Text = "MONTH" Or _
combomonth.Text = "" Or comboyear.Text = "YEAR" Or comboyear.Text = "" Then
MsgBox ("PLEASE ENTER A CORRECT DATE"), (vbCritical)
Exit Sub
End If
THIS CODE IS TO LET THE USER KNOW THAT ALL ROOMS MUST BE BOOKED A AT LEAST A DAY BEFORE IS
'NEEDED
If Val(comboday.Text) = Val(lblday.Caption) And Val(combomonth.Text) = Val(lblmonth.Caption) _
And Val(comboyear.Text) = Val(lblyear.Caption) Then
MsgBox ("ALL ROOMS MUST BE BOOK AT LEAST ONE DAY BEFORE IT IS NEEDED IF YOU NEED MORE INFORMATION OR NEED TO USE A ROOM BUT YOU HAVE NOT BOOKED IT, PLEASE ASK A MEMBER OF OUR STAFF"), (vbCritical)
Exit Sub
End If
If comboday.Text = "01" Or comboday.Text = "02" Or comboday.Text = "03" Or comboday.Text _
= "04" Or comboday.Text = "05" Or comboday.Text = "06" Or comboday.Text = "07" Or comboday.Text _
= "08" Or comboday.Text = "09" Or comboday.Text = "10" Or comboday.Text = "11" Or _
comboday.Text = "12" Or comboday.Text = "13" Or comboday.Text = "14" Or comboday.Text _
= "15" Or comboday.Text = "16" Or comboday.Text = "17" Or comboday.Text = "18" Or comboday.Text _
= "19" Or comboday.Text = "20" Or comboday.Text = "21" Or comboday.Text = "22" Or
comboday.Text = "23" Or comboday.Text = "24" Or comboday.Text = "25" Or comboday.Text _
= "26" Or comboday.Text = "27" Or comboday.Text = "28" Or comboday.Text = "29" Or comboday.Text _
= "30" Or comboday.Text = "31" Then
Else: MsgBox (" NO OTHER INFORMATION CAN BE ENTER, PLEASE SELECT A DAY FROM THE LIST FROM THE LIST"), (vbCritical)
comboday.Text = "DAY"
Exit Sub
End If
If combomonth.Text = "01" Or combomonth.Text = "02" Or combomonth.Text = "03" _
Or combomonth.Text = "04" Or combomonth.Text = "05" Or combomonth.Text = "06" _
Or combomonth.Text = "07" Or combomonth.Text = "08" Or combomonth.Text = "09" _
Or combomonth.Text = "10" Or combomonth.Text = "11" Or combomonth.Text = "12" Then
Else: MsgBox ("NOT NEW INFORMATION CAN BE ENTERED, PLEASE SELECT ONE OF THE MONTH ON THE LIST"), (vbCritical)
combomonth.Text = "MONTH"
Exit Sub
End If
If comboyear.Text = "2003" Or comboyear.Text = "2004" Or comboyear.Text = "2005" _
Or comboyear.Text = "2006" Or comboyear.Text = "2007" Then
Else: MsgBox ("NOT NEW INFORMATION CAN BE ENTERED, PLEASE SELECT ONE OF THE YEARS OF THE LIST"), (vbCritical)
comboyear.Text = "YEAR"
Exit Sub
End If
If Combohour.Text = "" Then
MsgBox "PLEASE ENTER START TIME"
Exit Sub
End If
If Combohours.Text = "" Then
MsgBox ("PLEASE ENTER FINISH TIME"), (vbCritical)
Exit Sub
End If
If Combohour.Text = "08:00 AM" Or Combohour.Text = "08:15 AM" Or Combohour.Text = "08:30 AM" _
Or Combohour.Text = "08:45 AM" Or Combohour.Text = "09:00 AM" Or Combohour.Text = "09:15 AM" _
Or Combohour.Text = "09:30 AM" Or Combohour.Text = "09:45 AM" Or Combohour.Text = "10:00 AM" _
Or Combohour.Text = "10:15 AM" Or Combohour.Text = "10:30 AM" Or Combohour.Text = "10:45 AM" _
Or Combohour.Text = "11:00 AM" Or Combohour.Text = "11:15 AM" Or Combohour.Text = "11:30 AM" _
Or Combohour.Text = "11:45 AM" Or Combohour.Text = "12:00 PM" Or Combohour.Text = "12:15 PM" _
Or Combohour.Text = "12:30 PM" Or Combohour.Text = "12:45 PM" Or Combohour.Text = "13:00 PM" _
Or Combohour.Text = "13:15 PM" Or Combohour.Text = "13:30 PM" Or Combohour.Text = "13:45 PM" _
Or Combohour.Text = "14:00 PM" Or Combohour.Text = "14:15 PM" Or Combohour.Text = "14:30 PM" _
Or Combohour.Text = "14:45 PM" Or Combohour.Text = "15:00 PM" Or Combohour.Text = "15:15 PM" _
Or Combohour.Text = "15:30 PM" Or Combohour.Text = "15:45 PM" Or Combohour.Text = "16:00 PM" _
Or Combohour.Text = "16:15 PM" Or Combohour.Text = "16:30 PM" Or Combohour.Text = "16:45 PM" _
Or Combohour.Text = "17:00 PM" Or Combohour.Text = "17:15 PM" Or Combohour.Text = "17:30 PM" _
Or Combohour.Text = "17:45 PM" Or Combohour.Text = "18:00 PM" Or Combohour.Text = "18:15 PM" _
Or Combohour.Text = "18:30 PM" Or Combohour.Text = "18:45 PM" Or Combohour.Text = "19:00 PM" _
Or Combohour.Text = "19:15 PM" Or Combohour.Text = "19:30 PM" Then
Else
Combohour.Text = ""
MsgBox ("NOT INFORMATION CAN BE ENTERED, PLEASE SELECT ANY HOUR ON THE LIST"), (vbCritical)
Exit Sub
End If
If Combohours.Text = "09:00 AM" Or Combohours.Text = "09:15 AM" Or Combohours.Text = "09:30 AM" _
Or Combohours.Text = "09:45 AM" Or Combohours.Text = "10:00 AM" Or Combohours.Text = "10:15 AM" _
Or Combohours.Text = "10:30 AM" Or Combohours.Text = "10:45 AM" Or Combohours.Text = "11:00 AM" _
Or Combohours.Text = "11:15 AM" Or Combohours.Text = "11:30 AM" Or Combohours.Text = "11:45 AM" _
Or Combohours.Text = "12:00 AM" Or Combohours.Text = "12:15 AM" Or Combohours.Text = "12:30 AM" _
Or Combohours.Text = "12:45 AM" Or Combohours.Text = "13:00 PM" Or Combohours.Text = "13:15 PM" _
Or Combohours.Text = "13:30 PM" Or Combohours.Text = "13:45 PM" Or Combohours.Text = "14:00 PM" _
Or Combohours.Text = "14:15 PM" Or Combohours.Text = "14:30 PM" Or Combohours.Text = "14:45 PM" _
Or Combohours.Text = "15:00 PM" Or Combohours.Text = "15:15 PM" Or Combohours.Text = "15:30 PM" _
Or Combohours.Text = "15:45 PM" Or Combohours.Text = "16:00 PM" Or Combohours.Text = "16:15 PM" _
Or Combohours.Text = "16:30 PM" Or Combohours.Text = "16:45 PM" Or Combohours.Text = "17:00 PM" _
Or Combohours.Text = "17:15 PM" Or Combohours.Text = "17:30 PM" Or Combohours.Text = "17:45 PM" Or Combohours.Text = "18:00 PM" Or Combohours.Text = "18:15 PM" _
Or Combohours.Text = "18:30 PM" Or Combohours.Text = "18:45 PM" Or Combohours.Text = "19:00 PM" _
Or Combohours.Text = "19:15 PM" Or Combohours.Text = "19:30 PM" Or Combohours.Text = "19:45 PM" _
Or Combohours.Text = "20:00 PM" Or Combohours.Text = "20:15 PM" Or Combohours.Text = "20:30 PM" _
Or Combohours.Text = "21:00 PM" Then
Else
Combohours.Text = ""
MsgBox ("NOT INFORMATION CAN BE ENTERED, PLEASE SELECT ANY HOUR ON THE LIST"), (vbCritical)
Exit Sub
End If
If Combohour.Text = Combohours.Text Then
MsgBox ("ANY ROOM MUST BE BOOK FOR MORE THAN 15 MINUTES"), (vbCritical)
Exit Sub
End If
If Combohour.Text > Combohours.Text Then
MsgBox ("THIS ROOM CAN NOT BE BOOK, THIS TIME HAS ALREADY PASS OR YOU ENTERED AN INCORRECT TIME PLEASE CHECK AGAIN "), (vbCritical)
Exit Sub
End If
BOOKINFO.Clear
BOOKINFO.AddItem "NAME: " + TextNAME.Text + " " + TextSURNAME
BOOKINFO.AddItem "COURSE CODE: " + coursecode.Text
BOOKINFO.AddItem "ROOM NUMBER: " + roomnumber.Text
BOOKINFO.AddItem "DATE: " + comboday.Text + " " + combomonth + " " + comboyear
BOOKINFO.AddItem "FROM: " + Combohour.Text
BOOKINFO.AddItem "TO: " + Combohours.Text
BOOKINFO.AddItem "NUMBER OF COMPUTER AND SOFTWARE AVAILABLE:"
- Code to ask the user if the information is correct.
If MsgBox("IS THIS INFORMATION CORRECT?" + vbCrLf + _
"NAME: " + TextNAME.Text + " " + TextSURNAME.Text _
+ vbCrLf + " COURSE CODE: " + coursecode.Text _
+ vbCrLf + " ROOM NUMBER: " + roomnumber.Text _
+ vbCrLf + "DATE: " + comboday.Text + " " + combomonth + " " + comboyear.Text _
+ vbCrLf + "FROM: " + Combohour _
+ vbCrLf + "TO: " + Combohours, vbOKCancel, _
"Save Record") = vbOK Then
- code to save the information as a text file.
Dim filenumber As Integer
filenumber = 1
Open "C:\BOOKING INFORMATION.TXT" For Append As #1
'Open "A:\booking information.txt" For Append As #1
'Open "D:\Visual Progamming\assigment\booking information.txt" For Append As #1
Print #1, vbCrLf
Print #1, " THIS ROOM HAS BEEN BOOKED"
Print #1, Date
Print #1, vbCrLf
Print #1, " name: " + TextNAME.Text + " " + TextSURNAME.Text '
Print #1, " course code: " + coursecode.Text
Print #1, " room number" + roomnumber.Text
Print #1, " date: " + comboday.Text + " " + combomonth.Text + " " + comboyear.Text
Print #1, " from: " + Combohour.Text
Print #1, " to: " + Combohours.Text
Print #1, vbCrLf
Print #1, "thank you for using this service " 'THIS WILL BE THE FOOTER
Print #1, vbCrLf
Close #1
Call Shell("NOTEPAD.EXE C:\BOOKING INFORMATION.TXT")
End If
End Sub
- CODES IN THE cmdload COMMAND BUTTON
- Codes to load and open the text file with the information the user just entered.
Dim filenumber As Integer
filenumber = 2
Open "C:\BOOKING.TXT" For Output As #2
'Open "A:\booking.txt" For Output As #2
'Open " D:\visual programming\assigment\booking.txt" for Output as #2
Print #2, vbCrLf
Print #2, " THIS ROOM HAS NOT BEEN BOOK YET"
Print #2, vbCrLf
Print #2, "DATE OF BOOKING" + " " + LBLDATE1.Caption
Print #2, vbCrLf
Print #2, "TIME OF BOOKING:" + " " + lbltime
Print #2, vbCrLf
Print #2, " name: " + TextNAME.Text + " " + TextSURNAME.Text
Print #2, " course code: " + coursecode.Text
Print #2, " room number: " + roomnumber.Text
Print #2, " date: " + comboday.Text + " " + combomonth.Text + " " + comboyear.Text
Print #2, " from: " + Combohour.Text
Print #2, " to: " + Combohours.Text
Print #2, vbCrLf
Print #2, "thank you for using this service "
Print #2, vbCrLf
Close #2
Call Shell("NOTEPAD.EXE C:\BOOKING.TXT")
'Call Shell("notepad.exe A:\booking.txt")
'Call Shell("notepad.exe D:\visual programming\assigment\booking.txt")
End Sub
- CODES IN THE cmdprint COMMAND BUTTON
- Codes to print all the information.
MsgBox "DO NOT FORGET TO SAVE OR YOUR REQUEST WILL NOT BE PROCESS"
Printer.CurrentX = 4400
Printer.CurrentY = 1440
Printer.FontName = "ARIAL"
Printer.FontSize = "15"
Printer.FontUnderline = True
Printer.Print "BOOKING INFORMATION"
Printer.FontSize = 10
Printer.Print ; vbCrLf
Printer.FontUnderline = False
Printer.FontBold = False
Printer.Print "///////////////////////////////////////////////////////////////////////////////////////////"
Printer.Print ; vbCrLf
Printer.Print "//////////////////////////////////////////////////////////////////////////////////////////"
Font.Size = 28
Printer.FontBold = True
Printer.Print ; vbCrLf
Printer.Print Date
Printer.FontBold = False
Printer.Print ; vbCrLf
Font.Size = "22"
Printer.FontBold = True
Printer.Print " NAME: "
Printer.FontBold = False
Printer.Print ; TextNAME.Text + " " + TextSURNAME.Text
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print " COURSE CODE: "
Printer.FontBold = False
Printer.Print ; coursecode.Text
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print "ROOM NUMBER: "
Printer.FontBold = False
Printer.Print ; roomnumber.Text
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print "DATE: "
Printer.FontBold = False
Printer.Print ; comboday.Text + " " + combomonth.Text + " " + comboyear.Text
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print "FROM: "
Printer.FontBold = False
Printer.Print ; Combohour.Text
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print "TO: "
Printer.FontBold = False
Printer.Print ; Combohours.Text
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print "NUMBER OF COMPUTER AVAILABLE"
Printer.Print ; vbCrLf
Printer.FontBold = False
If roomnumber.Text = "T100" Then
Printer.Print "25 COMPUTERS"
End If
If roomnumber.Text = "T229" Then
Printer.Print "25 COMPUTERS"
End If
If roomnumber.Text = "T201" Then
Printer.Print "25 COMPUTERS"
End If
If roomnumber.Text = "T232" Then
Printer.Print "25 COMPUTERS"
End If
If roomnumber.Text = "T217" Then
Printer.Print "25 COMPUTERS"
End If
If roomnumber.Text = "T212" Then
Printer.Print "20 COMPUTERS"
End If
If roomnumber.Text = "T211" Then
Printer.Print "20 COMPUTERS"
End If
If roomnumber.Text = "T221" Then
Printer.Print "20 COMPUTERS"
End If
If roomnumber.Text = "T227" Then
Printer.Print "25 COMPUTERS"
End If
If roomnumber.Text = "T223" Then
Printer.Print "15 COMPUTERS"
End If
If roomnumber.Text = "T152" Then
Printer.Print "15 COMPUTERS"
End If
Printer.Print ; vbCrLf
Printer.FontBold = True
Printer.Print "SOFTWARE AVAILABLE: "
Printer.FontBold = False
If roomnumber.Text = "T100" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T229" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T201" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T232" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T217" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T212" Then
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T211" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
End If
If roomnumber.Text = "T221" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
End If
If roomnumber.Text = "T227" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T223" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
If roomnumber.Text = "T152" Then
Printer.Print ; vbCrLf
Printer.Print "VISUAL BASIC"
Printer.Print ; vbCrLf
Printer.Print "SELECT"
Printer.Print ; vbCrLf
Printer.Print "FLASH"
End If
Printer.Print ; vbCrLf
Printer.Print "///////////////////////////////////////////////////////////////////////////////////////////"
Printer.Print ; vbCrLf
Printer.Print "//////////////////////////////////////////////////////////////////////////////////////////"
Printer.EndDoc
Close #1
End Sub
- CODES IN THE cmdreset COMMAND BUTTON
Private Sub cmdreset_Click
Coursecode.text = “select course code”
Roomnumber.text = “”
textNAME.text = “”
textSURNAME.text = “”
comboday.text = “DAY”
combomonth.text = “MONTH”
comboyear.text = “YEAR”
combohour.text = “”
combohours.text = “”
BOOKINFO.clear
Rooms1.clear
Des1.clear
Coursecode.SetFocus
End Sub
- CODES IN THE cmdabout COMMAND BUTTON
Private Sub CMDABOUT_Click()
FRMABOUT.Show vbModal
End Sub
- CODES IN THE cmdexit COMMAND BUTTON
Private Sub cmdexit_Click()
If MsgBox("are you sure you want to exit?", vbYesNo) = vbYes Then
End
End If
End Sub
-
CODES FOR cmdok BUTTON ON THE FRMABOUT FORM.
Private Sub CMDOK_Click()
Unload Me
End Sub
- CODES FOR timer1 on booking system form.
Private Sub Timer1_Timer()
lbltime.Caption = Format$(Time, "HH:MM")
LBLDATE1.Caption = Format$(Date, "dd - mm - yyyy")
lblday.Caption = Format$(Date, "d")
lblmonth.Caption = Format$(Date, "mm")
lblyear.Caption = Format$(Date, "yyyy")
lblhour.Caption = Format$(Time, "hh")
lblhours.Caption = Format$(Time, "hh")
End Sub
ASSUMPTIONS
- The college opens its doors at 8 o’clock in the morning, so booking start at the same time as well, the last booking has to be made before 18:30, the college closes its door at 21:00 o’clock.
- All booking must be done a least a day before the actual date the room is needed.
- All rooms must be booked for more a minimum of 15 minutes.
EVALUATION
Doing this project has been very hard because I did not have any knowledge of visual basic but reading some very good books gave me a big help.
Overall I think my design cover pretty much all the angles in the validation, I assumed I was the user and looked a every single possibilities that came to my mind, like what happens if I don’t select the course code but instead write my name on that combo box, what will the program do?.
If the program continues then I have to write a validation where the program is expecting the information that is already store in the system and that exactly what I did.
One of the most difficult things I found doing this project was working out the validation for the date, so that the user could booked rooms a date that has already passed.
One thing that I would do different is start documenting every single change I made to the program from the moment I started it, it was very difficult recalling everything I did from the start.
I have check my codes and design several times and the only thing I could enhance on the future is that if the user has already entered all the information but suddenly change any information like the date time etc, then I would show a message box asking the user if he/she wants to save the information that was there before he made the change.
Apart from this, I really enjoy myself doing this assignment.
REFERENCES
By Derek Christopher
2001
Publisher: Payne-Gallway
- MICROSOFT VISUAL BASIC PROGRAMMING PROJECTS
By John Sestak
2000
Publisher: South-Western Educational Publishing
By Peter Wright
2002
Publisher: Wrox