Hi,
I am stuck with this logical error and I was hoping someone could point me in the right direction. When I debug this program the array's do not contain the data from the textboxes that the user enetered. as far as I know the code is in the correct format but I may be mistaken. I need to use the public shared array's in order to allow otheer forms in the program to access the data. Any and all help would be greatly appreciated. Thank You, C.D.
I am not sure I enered this code propeerly in the web page editor either because it came back as all comments. If you could explain what I did wrong thier also I would appreciate it.
Have a nice day, C.D.
' Program Name: TicketSeller
' Developer: Charles
' Date: 5/28/14
' Purpose: This program accepts information from a user about an Event taking place at a college stadium it determines the
' price of tickets sales and records those sales. It displays a daily and weekly record of the sales on two separate
' forms. This program is designed to accept up to 100 event entries.
' Comments: This program is password protected. The password to open the menu is "pass". The Main menu is always available.
Public Class frmEventPlanner
' Declare and initialize variables
Public Shared _intSizeOfArray As Integer = 100
Public Shared _intEventCode(_intSizeOfArray) As Integer
Public Shared _strEventName(_intSizeOfArray) As String
Public Shared _strEventType(_intSizeOfArray) As String
Public Shared _strEventPriceClass(_intSizeOfArray) As String
Public Shared _strEventPromoterName(_intSizeOfArray) As String
Public Shared _strEventPromoterAddy(_intSizeOfArray) As String
Public Shared _strEventPromoterPhone(_intSizeOfArray) As String
Public Shared _strEventDate(_intSizeOfArray) As String
Public Shared _strRainDate(_intSizeOfArray) As String
Public Shared _strEventStartTime(_intSizeOfArray) As String
Public Shared _strEventTimeEnd(_intSizeOfArray) As String
Public Shared _decUpperPrice(_intSizeOfArray) As Decimal
Public Shared _decLowerPrice(_intSizeOfArray) As Decimal
Public Shared _strStaffContact(_intSizeOfArray) As String
Dim _Count As Integer = 0
Private Sub mnuLogin_Click(sender As System.Object, e As System.EventArgs) Handles mnuLogin.Click
Hide()
frmLogin.ShowDialog()
End Sub
Private Sub TicketSalesToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles mnuTicketSales.Click
'Opens Ticket Sales Window and Closes all others
Hide()
frmTicketSales.ShowDialog()
End Sub
Private Sub DailyReportsToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles mnuDailySales.Click
'Opens Daily Report Window and Closes this Window
Hide()
frmDailySales.ShowDialog()
End Sub
Private Sub WeeklyReportToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles mnuWeeklySales.Click
' Opens Weekly Report Window and Closes this Window
Hide()
frmWeeklySales.ShowDialog()
End Sub
Private Sub ExitToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles mnuExit.Click
' This menu event closes the window and application
Close()
End Sub
Private Sub ClearToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles mnuClear.Click
' This menu event clears all textboxes and resets the radio buttoms to the
' default settings on this window. it also sets the focus on the Event Name textbox
txtEventName.Clear()
txtPromoterAddy.Clear()
txtPromoterName.Clear()
mtxtPromoterPhone.Clear()
txtStaffContact.Clear()
mtxtEventStartTime.Clear()
mtxtEventEndTime.Clear()
lblCalendarError.Visible = False
lblRainDateError.Visible = False
radRainNo.Checked = False
radRainYes.Checked = False
radSports.Checked = True
radConcert.Checked = False
radMarket.Checked = False
radClassAPrice.Checked = False
radClassBPrice.Checked = True
radClassCPrice.Checked = False
radClassDPrice.Checked = False
radClassEPrice.Checked = False
txtEventName.Focus()
End Sub
Private Sub btnClear_Click(sender As System.Object, e As System.EventArgs) Handles btnClearForm.Click
' This event clears all textboxes and resets the radio buttoms to the
' default settings on this window. it also sets the focus on the Event Name textbox
txtEventName.Clear()
txtPromoterAddy.Clear()
txtPromoterName.Clear()
mtxtPromoterPhone.Clear()
txtStaffContact.Clear()
mtxtEventStartTime.Clear()
mtxtEventEndTime.Clear()
lblCalendarError.Visible = False
lblRainDateError.Visible = False
radRainNo.Checked = False
radRainYes.Checked = False
radSports.Checked = True
radConcert.Checked = False
radMarket.Checked = False
radClassAPrice.Checked = False
radClassBPrice.Checked = True
radClassCPrice.Checked = False
radClassDPrice.Checked = False
radClassEPrice.Checked = False
txtEventName.Focus()
End Sub
Private Sub btbSubmit_Click(sender As System.Object, e As System.EventArgs) Handles btbSubmit.Click
' This event handler initiates the storage of all the pertinent event information in the
' appropriate Array And designates an Event Code that correspondes to the position of the data in the array. It determines
' the price for the Upper and Lower seating sections based on the information the user entered.
' Declare and initialize Ticket Price variables.
Dim decAclassUpper As Decimal = 20D
Dim decAclassLower As Decimal = 30D
Dim decBclassUpper As Decimal = 7.5D
Dim decBclassLower As Decimal = 15D
Dim decCclassUpper As Decimal = 1D
Dim decCclassLower As Decimal = 1D
Dim decDclass As Decimal = 5D
Dim decEclass As Decimal = 0D
Dim txtEventDate As String = " "
Dim txtTodaysDate As String = " "
Dim txtRainDate As String = " "
' Determine Event Pricing
If radClassAPrice.Checked = True Then
_decUpperPrice(_Count) = decAclassUpper
_decLowerPrice(_Count) = decAclassLower
ElseIf radClassBPrice.Checked = True Then
_decUpperPrice(_Count) = decBclassUpper
_decLowerPrice(_Count) = decBclassLower
ElseIf radClassCPrice.Checked = True Then
_decUpperPrice(_Count) = CDec(InputBox("Please enter the desired price for the Lower section seating", "Suplemented Lower Level Pricing"))
_decLowerPrice(_Count) = CDec(InputBox("Please enter the desired price for the Upper section seating", "Suplemented Lower Level Pricing"))
ElseIf radClassDPrice.Checked = True Then
_decUpperPrice(_Count) = decDclass
_decLowerPrice(_Count) = decDclass
ElseIf radClassEPrice.Checked = True Then
_decUpperPrice(_Count) = decEclass
_decLowerPrice(_Count) = decEclass
End If
' Assign User input into the Programs array's and ensure all textboxes include data.
If txtEventName.Text = "" Then
MsgBox("Please enter the Event Name in the Event Name Textbox", MsgBoxStyle.DefaultButton1, "Required Field Error")
txtEventName.Focus()
lblInputError.Visible = True
Else
_strEventName(_Count) = txtEventName.Text
End If
If txtPromoterName.Text = "" Then
MsgBox("Please enter the Promoters Name in the Name Textbox", MsgBoxStyle.DefaultButton1, "Required Field Error")
txtPromoterName.Focus()
lblInputError.Visible = True
Else
_strEventPromoterName(_Count) = txtPromoterName.Text
End If
If txtPromoterAddy.Text = "" Then
MsgBox("Please enter the Promoters Address in the Address Textbox", MsgBoxStyle.DefaultButton1, "Required Field Error")
txtPromoterAddy.Focus()
lblInputError.Visible = True
Else
_strEventPromoterAddy(_Count) = txtPromoterAddy.Text
End If
If mtxtPromoterPhone.Text = "" Then
MsgBox("Please enter the Promoters Phone Number in the Phone Textbox", MsgBoxStyle.DefaultButton1, "Required Field Error")
mtxtPromoterPhone.Focus()
lblInputError.Visible = True
Else
_strEventPromoterPhone(_Count) = mtxtPromoterPhone.Text
End If
''''''''''''''''''''?????????????????????????????????????????''''''''''''''''''''
txtEventDate = cldEventDate.SelectionStart.ToShortDateString
txtTodaysDate = cldEventDate.TodayDate.ToShortDateString
txtRainDate = cldRainDate.SelectionStart.ToShortDateString
If txtEventDate < txtTodaysDate Then
lblCalendarError.Visible = True
Else
_strEventDate(_Count) = txtEventDate
End If
If radRainYes.Checked = True Then
If txtRainDate < txtTodaysDate Then
lblRainDateError.Visible = True
End If
_strRainDate(_Count) = txtRainDate
End If
'''''''''''''''''''''''?????????????????????????????????????????'''''''''''''''''''''''''''''''''
If txtStaffContact.Text = "" Then
MsgBox("Please enter the Executive Staff in Charge of the event in the Management Contact Textbox", MsgBoxStyle.DefaultButton1, "Required Field Error")
txtStaffContact.Focus()
lblInputError.Visible = True
Else
_strStaffContact(_Count) = txtStaffContact.Text
End If
MsgBox("Event " & _strEventName(_Count) & " Has been submitted. Thank You", MsgBoxStyle.DefaultButton1, "Verification")
End Sub
Private Sub radSports_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radSports.CheckedChanged
' Setd the Ticket Price to Standard for Sports Event
If radSports.Checked = True Then
radClassBPrice.Checked = True
End If
End Sub
Private Sub radConcert_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radConcert.CheckedChanged
'Sets the ticket price to Premium for Concerts
If radConcert.Checked = True Then
radClassAPrice.Checked = True
End If
End Sub
Private Sub radMarket_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radMarket.CheckedChanged
'Sets the ticket price to flat rate for Flea Market
If radMarket.Checked = True Then
radClassDPrice.Checked = True
End If
End Sub
Private Sub frmEventPlanner_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'Sets the focus in the Event Name Textbox
txtEventName.Focus()
End Sub
Private Sub btbEventCodeGen_Click(sender As System.Object, e As System.EventArgs) Handles btnEventCodeGen.Click
' designate an Event code # to be used as array placement retrieval variable show event code on form
btbSubmit.Enabled = True
lblGeneratedEventCode.Text = _Count.ToString
lblGeneratedEventCode.Visible = True
' Designate the Array index as the Event Code
_intEventCode(_Count) = _Count
'''''''''''''''''''''Thinking this may need to be changed''''''''''''''''''''''''''''''''
' add 1 to _Count
_Count += 1
End Sub
End Class
' Program Name: TicketSeller
' Developer: Charles
' Date: 5/28/14
' Purpose: This program accepts information from a user about an Event taking place at a college stadium it determines the
' price of tickets sales and records those sales. It displays a daily and weekly record of the sales on two separate
' forms.
' Comments: This program is password protected. The password to open the menu is "pass". The Main menu is always available.
Option Strict On
Public Class frmTicketSales
' Declare and Initailize Variables
Public Shared _intSizeOfArray As Integer = 100
Public Shared _strCustFirstName(_intSizeOfArray) As String
Public Shared _strCustLastName(_intSizeOfArray) As String
Public Shared _strCustAddy(_intSizeOfArray) As String
Public Shared _strCustPhone(_intSizeOfArray) As String
Public Shared _strCustEmail(_intSizeOfArray) As String
Public Shared _decNumberOfTickets(_intSizeOfArray) As Decimal
Public Shared _decTicketSection(_intSizeOfArray) As Decimal
Public Shared _decTotalPrice(_intSizeOfArray) As Decimal
Dim _intCurrentEvent As Integer
Private Sub mnuLogin_Click(sender As System.Object, e As System.EventArgs) Handles mnuLogin.Click
Hide()
frmLogin.ShowDialog()
End Sub
Private Sub EventPlannerToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles mnuEventPlanner.Click
' Opens Event Planner Window and Closes this Window
Hide()
frmEventPlanner.ShowDialog()
End Sub
Private Sub DailyReportsToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles mnuDailysales.Click
'Opens Daily Report Window and Closes this Window
Hide()
frmDailySales.ShowDialog()
End Sub
Private Sub WeeklyReportToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles mnuWeeklySales.Click
' Opens Weekly Report Window and Closes this Window
Hide()
frmWeeklySales.ShowDialog()
End Sub
Private Sub ExitToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles mnuExit.Click
' This menu event closes the window and application
Close()
End Sub
Private Sub ClearToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles mnuClear.Click
' This menu event clears all the textboxes and clears all the radio buttons as well as setting the focus on the event
' code textbox
txtCustEmail.Clear()
txtCustFirstName.Clear()
txtCustLastName.Clear()
txtCustPhone.Clear()
txtCustEmail.Clear()
txtCustAddy.Clear()
txtEventCodeVerification.Clear()
txtAmountTicketsPurchased.Clear()
txtEventCodeVerification.Focus()
radAlumni.Checked = False
radHome.Checked = False
radLower.Checked = False
radUpper.Checked = False
radVisitor.Checked = False
radStudent.Checked = False
End Sub
Private Sub btnClearSale_Click(sender As System.Object, e As System.EventArgs) Handles btnClearSale.Click
' This event clears all the textboxes and clears all the radio buttons as well as setting the focus on the event
' code textbox
txtCustEmail.Clear()
txtCustFirstName.Clear()
txtCustLastName.Clear()
txtCustPhone.Clear()
txtCustEmail.Clear()
txtCustAddy.Clear()
txtEventCodeVerification.Clear()
txtAmountTicketsPurchased.Clear()
txtEventCodeVerification.Focus()
radAlumni.Checked = False
radHome.Checked = False
radLower.Checked = False
radUpper.Checked = False
radVisitor.Checked = False
radStudent.Checked = False
End Sub
Private Sub btnCodeVerification_Click(sender As System.Object, e As System.EventArgs) Handles btnCodeVerification.Click
' This event verifies that a valid event has been chosen then displays the Event Name,Event Date
' and the current date. It also allows all the textboxes and group boxes to become visible.
' Declare and Initialize Variables
Dim strCurrentEvent As String
Dim txtSaleDate As String
' Ensures that thier is an event with the code number entered
strCurrentEvent = txtEventCodeVerification.Text
_intCurrentEvent = Convert.ToInt32(strCurrentEvent)
If _intCurrentEvent <= frmEventPlanner._intSizeOfArray - 1 Then
lblEventSalesTitle.Text = frmEventPlanner._strEventName(_intCurrentEvent)
lblEventDateSales.Text = frmEventPlanner._strEventDate(_intCurrentEvent)
txtSaleDate = cldSaleDate.TodayDate.ToShortDateString
lblSaleDate.Text = txtSaleDate
' Change labels and textboxes and Radio Buttons to Visible and enables the Process Button
lblEventSalesTitle.Visible = True
lblEventDateSales.Visible = True
lblSaleDate.Visible = True
txtAmountTicketsPurchased.Visible = True
txtCustAddy.Visible = True
txtCustEmail.Visible = True
txtCustFirstName.Visible = True
txtCustLastName.Visible = True
txtCustPhone.Visible = True
txtAmountTicketsPurchased.Visible = True
grpHomeVisitor.Visible = True
grpSchoolDiscount.Visible = True
grpUpperLower.Visible = True
btnProcess.Enabled = True
Else
MsgBox("The Event Code you entered does not exist Please try again)", MsgBoxStyle.DefaultButton1, "Invald Entry")
End If
' sets the focus in the Customer first Name Textbox
txtCustFirstName.Focus()
End Sub
Private Sub frmTicketSales_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
' sets the focus in the Event Code Verification textbox
txtEventCodeVerification.Focus()
End Sub
Private Sub btnProcess_Click(sender As System.Object, e As System.EventArgs) Handles btnProcess.Click
' This Event records the data the user entered into the appropriate Variables. It records the Customers
' Geographic information and the ticket(s) they wish to purchase. It determines the price charged the customer
' for the tickets purchased and stores all the information in the appropriate variables for later use.
' Declare and initialize variables
Dim decTicketSection As Decimal
Dim decPricePerTicket As Decimal
Dim strTicketAmount As String
Dim decTicketAmount As Decimal
' Record Customer's geographics
If txtCustFirstName.Text = "" Then
MsgBox("Please enter a value for the Customers First Name", MsgBoxStyle.DefaultButton1, "Input Error")
txtCustFirstName.Focus()
lblInputError.Visible = True
Else
_strCustFirstName(_intCurrentEvent) = txtCustFirstName.Text
End If
If txtCustLastName.Text = "" Then
MsgBox("Please enter a value for the Customers Last Name", MsgBoxStyle.DefaultButton1, "Input Error")
txtCustLastName.Focus()
lblInputError.Visible = True
Else
_strCustLastName(_intCurrentEvent) = txtCustLastName.Text
End If
If txtCustEmail.Text = "" Then
MsgBox("Please enter a value for the Customers Last Name", MsgBoxStyle.DefaultButton1, "Input Error")
txtCustEmail.Focus()
lblInputError.Visible = True
Else
_strCustEmail(_intCurrentEvent) = txtCustEmail.Text
End If
If txtCustAddy.Text = "" Then
MsgBox("Please enter a value for the Customers Last Name", MsgBoxStyle.DefaultButton1, "Input Error")
txtCustAddy.Focus()
lblInputError.Visible = True
Else
_strCustAddy(_intCurrentEvent) = txtCustAddy.Text
End If
If txtCustPhone.Text = "" Then
MsgBox("Please enter a value for the Customers Last Name", MsgBoxStyle.DefaultButton1, "Input Error")
txtCustPhone.Focus()
lblInputError.Visible = True
Else
_strCustPhone(_intCurrentEvent) = txtCustPhone.Text
End If
' Determine Section Seating (The code for sections is as follows:)
' Home-Lower is Ticket Section-1
' Home-Upper is Ticket Section-2
' Visitor-Upper is Ticket Section-3
' Visitor-Lower is Ticket Section-4
If radHome.Checked = True And radUpper.Checked = True Then
decTicketSection = 2
End If
If radHome.Checked = True And radLower.Checked = True Then
decTicketSection = 1
End If
If radVisitor.Checked = True And radUpper.Checked = True Then
decTicketSection = 3
End If
If radVisitor.Checked = True And radLower.Checked = True Then
decTicketSection = 4
End If
' Determine the price per Ticket
If decTicketSection = 1 Then
decPricePerTicket = frmEventPlanner._decLowerPrice(_intCurrentEvent)
End If
If decTicketSection = 2 Then
decPricePerTicket = frmEventPlanner._decUpperPrice(_intCurrentEvent)
End If
If decTicketSection = 3 Then
decPricePerTicket = frmEventPlanner._decUpperPrice(_intCurrentEvent)
End If
If decTicketSection = 4 Then
decPricePerTicket = frmEventPlanner._decLowerPrice(_intCurrentEvent)
End If
' Determine the total Cost of Tickets
strTicketAmount = txtAmountTicketsPurchased.Text
decTicketAmount = Convert.ToDecimal(strTicketAmount)
_decTotalPrice(_intCurrentEvent) = decTicketAmount * decPricePerTicket
' Record Ticket Section for later use
_decTicketSection(_intCurrentEvent) = decTicketSection
' Record amount of tickets purchased for later use
_decNumberOfTickets(_intCurrentEvent) = decTicketAmount
End Sub
End Class