| | |
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 21 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 ado.net algorithm array barchart bitmap box broadcast buttons c# check checkbox client combobox connection console control conversion csharp custom database datagrid datagridview dataset datetime degrees deployment developer development draganddrop drawing editing encryption enum event excel file form format forms function gdi+ hospitalmanagementinformationsystem httpwebrequest image imageprocessing index input install java label list listbox mandelbrot math mouseclick mysql operator oracle path photoshop picturebox pixelinversion post priviallages. programming radians regex remote remoting richtextbox rows serialization server sleep socket sql statistics stream string table temperature text textbox thread time timer txt update uploadatextfile usercontrol validation visualstudio webbrowser windows windowsformsapplication winforms wpf xml






