Inside my form I have this code:
int[] totalScoreArray = new int[20];
int intScoreCount = 0;
For my assignment I need to: Modify the Click event handler for the Add button so it adds the score that’s entered by the user to the next element in the array. To do that, you can use the score count variable to refer to the element.
What I'm having trouble with: All of the scores are entered into a textbox that I have on my form called txtScore. I know that to add items to an array you just put the array name and then write .Add(); But, here I'm not sure what to use since I'm taking the text boxes input and not an actual number. So I know I can't write totalScoreArray.Add(txtScore.Text); but that is what I want to do, meaning I want to take the scores entered in the txtScore text box and put them into the next element. I'm not sure how to do this and I'm not really sure what I'm supposed to search to figure this out. I tried array C# but the examples I found used List<TextBox> myTextboxList = new List<TextBox>();. I can't use List because my directions want me to write it using regular arrays. Can someone please help me out? *No I'm not trying to get the answer, I seriously want to understand this.
int[] totalScoreArray = new int[20];
int intScoreCount = 0;
For my assignment I need to: Modify the Click event handler for the Add button so it adds the score that’s entered by the user to the next element in the array. To do that, you can use the score count variable to refer to the element.
What I'm having trouble with: All of the scores are entered into a textbox that I have on my form called txtScore. I know that to add items to an array you just put the array name and then write .Add(); But, here I'm not sure what to use since I'm taking the text boxes input and not an actual number. So I know I can't write totalScoreArray.Add(txtScore.Text); but that is what I want to do, meaning I want to take the scores entered in the txtScore text box and put them into the next element. I'm not sure how to do this and I'm not really sure what I'm supposed to search to figure this out. I tried array C# but the examples I found used List<TextBox> myTextboxList = new List<TextBox>();. I can't use List because my directions want me to write it using regular arrays. Can someone please help me out? *No I'm not trying to get the answer, I seriously want to understand this.