Array Problems
Hello,
My problem here is that I am trying to print a form that stores the name of the selectedindex and the price side by side as you select one of the seat types. I keep getting the seats displaying on knew lines individually with their prices, but I don't want them to display individually, I want the price in the printpreview area to show the added price of the same seat when I click the print summary, not a knew line displaying that it was selected twice. Their is no summary form, just one form and an option to print your results. I have attached a picture of the form so you can see what it looks like. I only am showing a little of the code to keep things simple, and only one seat since the rest would be redundant I think.
Public Class clubForm
' Declare structure and module-level variables
Structure clubSale
Dim typeString As String
Dim quantityString As String
Dim priceDecimal As Decimal
End Structure
Private transactionclubSale(20) As clubSale
Private numberTransactionsInteger As Integer
Private priceDecimal() As Decimal = {40D, 27.5D, 15D, 10D}
Private selectedListString As String
Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click
' Close the project.
Me.Close()
End Sub
Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculateButton.Click
' Look up the price using the type of seating.
Dim rowInteger As Integer
Dim salePriceDecimal As Decimal
With Me
' Allow only 20 transactions.
If numberTransactionsInteger < 20 Then
rowInteger = .clubListBox.SelectedIndex
If rowInteger <> -1 Then
Select Case selectedListString
Case "Orchestra"
rowInteger = 0
transactionclubSale(numberTransactionsInteger).typeString = "Orchestra"
End Select
' Retrieve price of selection
salePriceDecimal = priceDecimal(0)
priceTextBox.Text = salePriceDecimal.ToString("C")
' Save this transaction.
transactionclubSale(numberTransactionsInteger).typeString = .clubListBox.Text
transactionclubSale(numberTransactionsInteger).priceDecimal = salePriceDecimal
numberTransactionsInteger += 1
End If
End If
End With
Please share your thoughts on this. Thank you.
|