| | |
lines in a text file
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2009
Posts: 3
Reputation:
Solved Threads: 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:
Unfortunately the error is "No overload for method 'ReadLine' takes '1'."
Please help?
N.
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:
C# Syntax (Toggle Plain Text)
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.
StreamReader.ReadLine() takes no arguments.You can hold the text file string into string then cut\split it by '\n' then refer to the index of the array returned.
Here also an example: http://msdn.microsoft.com/en-us/libr....readline.aspx
Last edited by Ramy Mahrous; Apr 26th, 2009 at 9:12 am. Reason: Example added
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
•
•
Join Date: Apr 2009
Posts: 3
Reputation:
Solved Threads: 0
•
•
•
•
StreamReader.ReadLine()takes no arguments.
You can hold the text file string into string then cut\split it by '\n' then refer to the index of the array returned.
Here also an example: http://msdn.microsoft.com/en-us/libr....readline.aspx
Thanks, this is a great help.
•
•
Join Date: Oct 2009
Posts: 1
Reputation:
Solved Threads: 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:
C# Syntax (Toggle Plain Text)
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
#5 18 Days Ago
C# Syntax (Toggle Plain Text)
textBox1.Text = System.IO.File.ReadAllLines(@"C:\file.txt")[0]; //line 1 textBox1.Text = System.IO.File.ReadAllLines(@"C:\file.txt")[1]; //line 2
![]() |
Similar Threads
- Counting lines in a text file and further operations (C++)
- Reading Lines from Text File (C)
- Script to Remove duplicate lines from a text file. (Perl)
- Newbie: problems deleting lines from text file (large) (Python)
- read-delete lines from a text file (PHP)
- how to remove a number of lines from a text file ? (Python)
- # of lines in a text file (Java)
- how do i read the last line of a text file? (Python)
- help on using StringTokenizer to read and compute multiple lines from text (Java)
Other Threads in the C# Forum
- Previous Thread: using INI(setting) file in c#
- Next Thread: Problem with ComboBox display
| Thread Tools | Search this Thread |
.net access algorithm array backup barchart bitmap box broadcast buttons c# check checkbox client clock combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees developer development draganddrop drawing dynamiccreation encryption enum excel file form format forms function gdi+ hospitalmanagementsystems httpwebrequest image index input install interface java label list listbox mandelbrot math microsystems mouseclick mysql operator password path photoshop picturebox pixelinversion post priviallages. programming property radians regex remoting richtextbox running... serialization server sleep soap socket sql sqlserver stack statistics stream string table temperature text textbox thread time timer update usercontrol validation visualstudio webbrowser windows windowsformsapplication winforms wpf write xml






