0

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.

4
Contributors
4
Replies
7
Views
8 Years
Discussion Span
Last Post by sknake
0

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

0
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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.