Hey folks.
I hope you can all help me. Basically, I'm designing a small GUI Windows program that allow staff at a cinema to reserve seats for customers. There will be a total of 60 seats in the cinema. I have two classes in my program:-
1.) MainForm.vb - used for I/O actions and user interaction
2.) SeatManager.vb - used to hold and handle the background methods and functions that make the program work
Here is the code for my MainForm.vb class thusfar:-
Public Class MainForm
Private Const m_totalNumberOfSeats As Integer = 60
Private m_seatManager As SeatManager
Public Sub New()
InitializeComponent()
m_seatManager = New SeatManager(m_totalNumberOfSeats)
InitializeGUI()
End Sub
''' <summary>
''' Method called from the MainForm() method. This method is called when the form
''' is opened by the program (on initialisation).
''' </summary>
Private Sub InitializeGUI()
rbtnReservation.Checked = True 'Sets the Reserve button as being chosen
lstReservations.Items.Clear() 'Clears the list displaying all seats and reservations
txtCustomerName.Text = String.Empty 'Sets the name textbox as emtpy
txtSeatPrice.Text = String.Empty
End Sub
End Class
...and here's my code for the SeatManager.vb class:-
Public Class SeatManager
Dim m_nameList As String()
Dim m_priceList As Double()
Dim m_totalNumberOfSeats As Integer
Public Sub New(ByVal maxNumberOfSeats)
m_totalNumberOfSeats = maxNumberOfSeats
m_nameList = New String(m_totalNumberOfSeats - 1) {}
m_priceList = New Double(m_totalNumberOfSeats - 1) {}
End Sub
End Class
Basically, when the program opens, the lstReservations list in the MainForm class will be populated with a total of 60 (m_totalNumberOfSeats) entries to represent 60 seats. Each of these seats will contain the index number from the array m_nameList; this index number (+1) will represent the seat number and then in the lstReservations list, after the seat number, I'd like it to contain the respective entry from the m_nameList array. As all entries will be held in RAM, when the GUI is opened, all m_nameList array entries will be empty. As the user uses the program, they can highlight a row in the lstReservations list and then use the GUI textboxes to enter the customer's name which will then be populated into the respective array entry.
Can anyone offer any pointers as to how to, when the GUI opens, ensure that the lstReservations list takes all of the blank entries from the m_nameList array and from there, I can highlight a row to carry out further methods on?
Thanks in advance