|
-
Jan 30th, 2007, 11:00 AM
#1
Thread Starter
Member
Fixing a value to an element of array.
I hope I got the terminology right.
I'm creating a simple hotel reservation system.
The inputbox will validate the users (called a, b, and c) and will loop if the name is wrong. I have no problem at this part.
Next, if the name matches the array of users I have just stored, they will be allowed to book a room. (room 1, 2 , or 3)
Here is my problem, how do I attach the room number with particular users so that when the next user use the program (without exiting the program so that memory is not dumped), they will not be allowed to book rooms that have been booked before.
Here is my simple code.
VB Code:
guest(0) = "a"
guest(1) = "b"
guest(2) = "c"
Do
strinput = InputBox("Who are you?")
'Check if the name is in the array
For i = 0 To 2
If guest(i) = strinput Then
blnvalid = True
ElseIf strinput = "x" Then
End
End If
Next i
'Loop while a valid name has not been entered
Loop While Not blnvalid
'PROBLEM STARTS HERE
room = InputBox("Choose a room")
Do While room < 1 Or room > 3
room = InputBox("Out of range. reenter room 1-3 please")
Loop
'How do I attach particular element of array to
'the room number so that no element of array (a, b, c)
'can have the same room number
Last edited by vert; Jan 30th, 2007 at 12:25 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|