I am making a program that is a golf scorecard. There is a text file for the selected course they choose and when they click a button I want the program to display the previous round to numericUpDowns I have created(there are 9 of them named num(1-9).
I want the program to display the previous round, then when the user saves their current round it overwrites the textile and removes the old round, and saves the new. I hope this makes sense with what I am trying to do. I need to convert the textile string to integers that way I can display the scores and save them.
I tried this but it does not work I just wanted to see if one line is displayed. Right now the text file has the numbers 0 going down vertically 9 times for each numericUpDown but nothing is displayed in the numUpDowns.
try
{
//open file
StreamReader InputFile;
InputFile = File.OpenText("Course1.txt");
//read lines and display previous scores
num1.Value.ToString(Convert.ToInt32(InputFile.ReadLine()));
}
catch (IOException)
{
MessageBox.Show("There was an error loading Course1.txt");
}