Question: Write a program that includes the following five events: Open File Button Click - Input a list of numbers from a text file and print
Write a program that includes the following five events:
Open File Button Click Input a list of numbers from a text file and print the numbers to a ListBox. Use
OpenFileDialog to let the user choose the text file to open. Use StreamWriterCeateText to open the file
and a While Loop to read each line of the selected file and add it to the lstOutput ListBox be sure clear the listbox
first
Compute Statistics Button Click Compute and display to TextBoxes the following statistics from the numbers in
the ListBox. count, sum, average, minimum, maximum, count of even#s count of negative #s Use one or more For
Loops do not use any built in functions to compute the sum, average, minimum, maximum, even # count, and negative
# count of the numbers in the ListBox.
Suggested variables: numCount, sum, avg, min, max, evenCount, negCount
Suggested textboxes: txtNumCount, txtSum, txtAvg, txtMin, txtMax, txtEvenCount, txtNegCount.
Add Number Button Click Add a number to the ListBox. Use an InputBox to allow the user to enter a number
to add to the ListBox. Give an error message and end the procedure if the user input is not a valid an integer.
Delete Selected Number Button Click Delete the selected number from the ListBox. Give an error message and
end the procedure if nothing is selected.
Save Save As Button Click Save the ListBox contents to a text file. Use SaveFileDialog to let the user
choose a name and location to save to Use StreamWriterCeateText and a For. Loop to write the numbers in
the ListBox to the specified name and location. Show a confirmation MessageBox if save is successful.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
