Hello,
I was just wondering how I would refer to a certain line in a text file. It is by using an index of some sort? here is my try:

using (StreamReader worldlist = new StreamReader("wordlist.txt"))
                            {
                                string line;
                                line = worldlist.ReadLine(count);

                                listBox1.Items.Add(line);

                            }

Unfortunately the error is "No overload for method 'ReadLine' takes '1'."
Please help?
N.

Hello,
I was just wondering how I would refer to a certain line in a text file. It is by using an index of some sort? here is my try:

using (StreamReader worldlist = new StreamReader("wordlist.txt"))
                            {
                                string line;
                                line = worldlist.ReadLine(count);

                                listBox1.Items.Add(line);

                            }

Unfortunately the error is "No overload for method 'ReadLine' takes '1'."
Please help?
N.

ans.the error occur caz ReadLine method cannt take any of the argument caz it hav to take value on the runtime
to take value on runtime ,in c#there is another procees of command line arguments

textBox1.Text = System.IO.File.ReadAllLines(@"C:\file.txt")[0]; //line 1
      textBox1.Text = System.IO.File.ReadAllLines(@"C:\file.txt")[1]; //line 2
This article has been dead for over six months. Start a new discussion instead.