Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Fix this application so that it will accumulate the total number of raffle tickets sold by each of 8 scout troops. The troop number is

Fix this application so that it will accumulate the total number of raffle tickets sold by each of 8 scout troops.

The troop number is selected from a list box.

The number of tickets is input into a text box.

The sales will be input in any order and there can be multiple sales for each troop.

You must validate that a group number was selected and an integer number was entered in the text box before data will be stored in array totals.

The ok button will verify data and if valid add the number of tickets sold to the appropriate total.

The display totals button will display the totals for each troop and the total for all troops.

The exit button will terminate the application after verification of exit.

The screens shown below show an example of the application running.

The top screen shows the application when it starts.

The other screens show the application after the user has clicked each of the buttons.

The forms will be centered on the screen when running.

image text in transcribed

image text in transcribed

image text in transcribed

Public Class TicketForm Declare class level variables. Private intTroopTotal) As Integer Hold totals for 8 groups Private intAllTroopsTotal 10 Private Sub btnoK_Click(sender As object, e As EventArgs) Handles btnok.click " Accumulate the sales by troop number 13 14 Dim intsalesInput As Integer Dim intIndex As Integer 16 If lstGroups.selectedIndex Then 18 19 intIndex = 1stGroups. SelectedIndex Try intsalesInput -Integer.Parse(txtsales. Text) Try intTroopTotalf2 ?ntsales1nput intAllTroopsTotal += ?ntsalesInput Clear the screen fields txtsales.Text lstGroups.selectedIndex 1 26 29 30 31 32 Catch exAnyotherException As Display generic error message MessageBox.Show(exAnyotherException.Message, "Miscellaneous error caught by system", MessageBoxButtons.oKcancel, MessageBoxIcon.Error) End Try Catch exSales As 35 36 37 38 Display a message box to the user indicating the number tickets sold entered is invalid MessageBox.Show("sales - The value must be a integer number", "Date Entry Error", MessageBoxButtons.oK, MessageBoxIcon.Error) With txtsales 41 43 End With End Try MessageBox.Show("select a group number from the list.", "Data Entry Error", lstGroups.Focus(O 45 Else 47 MessageBoxButtons.oK, MessageBoxIcon.Error) End If 49 50 End Sub Public Class TicketForm Declare class level variables. Private intTroopTotal) As Integer Hold totals for 8 groups Private intAllTroopsTotal 10 Private Sub btnoK_Click(sender As object, e As EventArgs) Handles btnok.click " Accumulate the sales by troop number 13 14 Dim intsalesInput As Integer Dim intIndex As Integer 16 If lstGroups.selectedIndex Then 18 19 intIndex = 1stGroups. SelectedIndex Try intsalesInput -Integer.Parse(txtsales. Text) Try intTroopTotalf2 ?ntsales1nput intAllTroopsTotal += ?ntsalesInput Clear the screen fields txtsales.Text lstGroups.selectedIndex 1 26 29 30 31 32 Catch exAnyotherException As Display generic error message MessageBox.Show(exAnyotherException.Message, "Miscellaneous error caught by system", MessageBoxButtons.oKcancel, MessageBoxIcon.Error) End Try Catch exSales As 35 36 37 38 Display a message box to the user indicating the number tickets sold entered is invalid MessageBox.Show("sales - The value must be a integer number", "Date Entry Error", MessageBoxButtons.oK, MessageBoxIcon.Error) With txtsales 41 43 End With End Try MessageBox.Show("select a group number from the list.", "Data Entry Error", lstGroups.Focus(O 45 Else 47 MessageBoxButtons.oK, MessageBoxIcon.Error) End If 49 50 End Sub

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago