![]() |
| ||
| Need Help With two-dimensional array 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 |
| All times are GMT -4. The time now is 10:17 am. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC