User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 375,195 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,156 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser:
Views: 21097 | Replies: 0
Reply
Join Date: May 2004
Posts: 7
Reputation: scottjo is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
scottjo scottjo is offline Offline
Newbie Poster

Need Help With two-dimensional array

  #1  
Aug 30th, 2004
I need help with a program. It’s suppose to keep track of motel reservations.

A guest’s name is entered and then assigned to a room. The motel has three floors and 40 rooms (numbered 1 to 40).

The program is suppose to reserve a room, cancel a reservation, and display all the rooms on one floor along with the names of guests who have reserved the rooms. Guest cannot reserve a room that has already been reserved.

One form will be used to display the reservations for one floor, and a separate form will be used for making/canceling reservations. When canceling a reservation, provide some sort of "are you sure" safety check, such as a message box. At least one two-dimensional array is to be used..

The problem I am having is that I’m not sure how to stop the user from reserving a room that has already been reserved.. The program just displays the information entered in. The code is located below. Any help would be apprecaiated.



Public Class Form1
Inherits System.Windows.Forms.Form
Dim HotelArray(3, 40)
Dim intRowNumber As Integer
Dim intColumnNumber As Integer
Dim x As Integer
Dim y As Integer
Dim mblnFloorFound As Boolean = False
Dim mblnRoomFound As Boolean = False
Dim mintRoomSub As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For x = 1 To 3
lstFloor.Items.Add(x)
Next x
End Sub

Private Sub btnReserve_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReserve.Click
intFloor = CInt(lstFloor.SelectedIndex) + 1
intRoom = CInt(NumericUpDown1.Value)
strName = CStr(txtName.Text)
intRowNumber = intFloor
intColumnNumber = intRoom
HotelArray(intRowNumber, intColumnNumber) = intFloor & " " & intRoom
End Sub

Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
lstGuestInfo.Items.Add("Floor Number:" & " " & HotelArray(intRowNumber, intColumnNumber) & " " & "Customer Name:" & " " & strName)
End Sub

End Class
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb VB.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 2:16 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC