Hi,
was wondering if it is possible to use openfiledialog to find a file and then use streamreader to read the text and use it in a variable? Got this so far but it comes up with this error: "Object reference not set to an instance of an object." the error appears on the "lblhighscore.Text = SR.ReadLine();" line
OpenFileDialog HiScoreOpen = new OpenFileDialog();
HiScoreOpen.Filter = "TXT|*.txt";
if (HiScoreOpen.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string openFileLocation = HiScoreOpen.FileName;
StreamReader SR = null;
SR = new StreamReader(HiScoreOpen.FileName);
lblhighscore.Text = SR.ReadLine();
SR.Close();
highscore = lblhighscore.text;
Thanks