Hi Visual Basic people,
I have problems figuring out how to seperate a single person to display on my listbox.
I am currently working on an assignment called "Douglas Resort Reservation" and we are supposed to select a query from the combo box Guest Search. For example, when I select Barb Allen, I get the info to display properly, which is good. But, I still have a problem.

When I try to click my button 'Prepare Invoice', I want Barb Allen's info to be displayed in my listbox 'Invoice'. But, now I don't have that complete. I have a whole list of items generated when I load my whole thing from my Form Load event from the textfile RESORT.TXT. I get a whole list of items instead of individualized items.
My question for you is: "How can I get just ONE name and person's information to show up?" when I press the button 'Prepare Invoice'.
and display information like this:
Barb Allen 604 777 1234
# of Adults 3
# of kids 1
Check In 2008-12-01
Check Out 2008-12-03
Meal Plan Breakfast and Dinner
Membership Douglas Club
Here's my source code if you want to view it; this might help.
CODE
Public Class frmResort
Structure resortStructure
Dim customerName As String
Dim phoneNumber As String
Dim checkInDate As Date
Dim daysToStay As Integer
Dim numberOfAdults As Integer
Dim numberOfKids As Integer
Dim mealPlan As Char
Dim memberLetter As String
End Structure
Dim guestlist(4) As resortStructure
Private Sub frmResort_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim sr As IO.StreamReader = IO.File.OpenText("RESORT.TXT")
For i As Integer = 0 To 4
guestlist(i).customerName = sr.ReadLine
guestlist(i).phoneNumber = sr.ReadLine
guestlist(i).checkInDate = CDate(sr.ReadLine)
guestlist(i).daysToStay = CInt(sr.ReadLine)
guestlist(i).numberOfAdults = CInt(sr.ReadLine)
guestlist(i).numberOfKids = CInt(sr.ReadLine)
guestlist(i).mealPlan = CChar(sr.ReadLine)
guestlist(i).memberLetter = sr.ReadLine
Next
sr.Close()
For i As Integer = 0 To 4
cmbGuestSearch.Items.Add(guestlist(i).customerName & " " & guestlist(i).phoneNumber)
Next
Array.Sort(guestlist, New Comparer)
End Sub
Sub ClearData()
lstInvoice.Items.Clear()
End Sub
Sub ProcessInvoice()
ClearData()
For i As Integer = 0 To 4
lstInvoice.Items.Add(guestlist(i).customerName & " " & guestlist(i).phoneNumber)
lstInvoice.Items.Add("# of Adults" & " " & guestlist(i).numberOfAdults)
lstInvoice.Items.Add("# of kids" & " " & guestlist(i).numberOfKids)
lstInvoice.Items.Add("Check In" & " " & guestlist(i).checkInDate.ToString("yyyy-MM-dd"))
lstInvoice.Items.Add("Check Out" & " " & guestlist(i).checkInDate.AddDays(guestlist(i).daysToStay).ToString("yyyy-MM-dd"))
If guestlist(i).mealPlan = "1" Then
lstInvoice.Items.Add("Meal Plan" & " " & "Breakfast")
ElseIf guestlist(i).mealPlan = "2" Then
lstInvoice.Items.Add("Meal Plan" & " " & "Dinner")
ElseIf guestlist(i).mealPlan = "3" Then
lstInvoice.Items.Add("Meal Plan" & " " & "Breakfast and Dinner")
ElseIf guestlist(i).mealPlan = "4" Then
lstInvoice.Items.Add("Meal Plan" & " " & "No Meal Plan Ordered")
End If
If guestlist(i).memberLetter = "B" Then
lstInvoice.Items.Add("Membership" & " " & "BCAA")
ElseIf guestlist(i).memberLetter = "D" Then
lstInvoice.Items.Add("Membership" & " " & "Douglas Club")
ElseIf guestlist(i).memberLetter = "N" Then
lstInvoice.Items.Add("Membership" & " " & "N/A")
End If
Next
End Sub
Private Sub btnPrepareInvoice_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrepareInvoice.Click
ClearData()
ProcessInvoice()
End Sub
Private Sub cmbGuestSearch_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbGuestSearch.SelectedIndexChanged
For i As Integer = 0 To 4
txtGuestName.Text = guestlist(cmbGuestSearch.SelectedIndex).customerName
txtCheckInDate.Text = guestlist(cmbGuestSearch.SelectedIndex).checkInDate.ToString("yyyy-MM-dd")
txtNoOfAdults.Text = guestlist(cmbGuestSearch.SelectedIndex).numberOfAdults.ToString()
txtNoOfKids.Text = guestlist(cmbGuestSearch.SelectedIndex).numberOfKids.ToString()
txtGuestPhone.Text = guestlist(cmbGuestSearch.SelectedIndex).phoneNumber
txtNoDaysToStay.Text = guestlist(cmbGuestSearch.SelectedIndex).daysToStay.ToString()
If guestlist(cmbGuestSearch.SelectedIndex).mealPlan = "1" Then
chkBreakfast.Checked = True
ElseIf guestlist(cmbGuestSearch.SelectedIndex).mealPlan = "2" Then
chkDinner.Checked = True
ElseIf guestlist(cmbGuestSearch.SelectedIndex).mealPlan = "3" Then
chkDinner.Checked = True
chkBreakfast.Checked = True
ElseIf guestlist(cmbGuestSearch.SelectedIndex).mealPlan = "4" Then
chkBreakfast.Checked = False
chkDinner.Checked = False
End If
If guestlist(cmbGuestSearch.SelectedIndex).memberLetter = "B" Then
radBCAA.Checked = True
ElseIf guestlist(cmbGuestSearch.SelectedIndex).memberLetter = "D" Then
radDouglasClub.Checked = True
ElseIf guestlist(cmbGuestSearch.SelectedIndex).memberLetter = "N" Then
radNA.Checked = True
End If
Next
End Sub
End Class
Public Class comparer
Implements IComparer(Of frmResort.resortStructure)
Public Function Compare(ByVal x As frmResort.resortStructure, ByVal y As frmResort.resortStructure) As Integer Implements System.Collections.Generic.IComparer(Of frmResort.resortStructure).Compare
Return x.customerName.CompareTo(y.customerName)
End Function
End Class
I'm desperate for help,
- Nathe