I'm using C# and writing a Windows Form application for Windows 7 or Windows 8.
I need to know how to get my app to read a specific line which should be assigned to a specific text box or combo box.
This is the code I have so far.
using (StreamReader QNARead = new StreamReader(TestPath))
if (QNARead.Peek() >= 0)
{
string Line1 = QNARead.ReadLine();
QuestionText1.Text = Line1;
string Line2 = QNARead.ReadLine();
QuestionText2.Text = Line2;
string Line3 = QNARead.ReadLine();
AlternativesList1.Items.Add(Line3);
}
But with this method I'll have to read a lot of lines, because the line could be the 500th in the text file. (I do know the exact line number, eg. 54).