We start by getting familiar with the C# Form Controls on our C# Winforms and structure of our text file. Then we proceed to read the text file into a C# array.
Suppose we wish to process survey results that are stored in a file. First, create a Windows Form that prompts the user for survey responses and outputs each response to a file. Use StreamWriter to create a file called numbers.txt. Each integer should be written using method Write.Then add a TextBox that will output the frequency of survey responses. Read the survey responses from numbers.txt. The responses should be read from the file by using a StreamReader. Class string’s Split method should be used to split the input string into separate responses, then each response should be converted to an integer. The program should continue to read responses until it reaches the end of file. The results should be output to the TextBox.
DOWNLOAD SOURCE FILES: yt-17-8-StudentPoll