I'm trying to make windows form that can read in golf scores from a text file. The first line in the file indicates the number of holes the player has completed. This is known as 'int holes' in my code. There are 'holes' numbers after the first line about the par of each hole, and 'holes' numbers after the par about what the player scored.
i.e. text file
3 [completed holes] (if this number were 4, then there would be 4 par values and 4 score values)
2 [par]
3 [par]
2 [par]
3 [score]
2 [score]
3 [score]
The problem is I don't know how to make two arrays with 'holes' sizes with 'par' and 'score' values and display them to the user. All I've managed to do so far is gotten the program to read in the first line of the text file and declare the variable for holes as an int.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace GolfScore
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void loadToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog fileDialog = new OpenFileDialog();
if (fileDialog.ShowDialog() == DialogResult.OK)
{
StreamReader sr = new StreamReader(fileDialog.OpenFile());
string line = sr.ReadLine();
int holes = int.Parse(line);
}
}
}
}
I've tried to be as descriptive as I can be, so please, help me.

New Topic/Question
Reply




MultiQuote





|