how do i read the last line of a document and put it into an array?
double lastLine = code for reading last line;
myArray.SetValue(lastLine, 0);
something like that?.. yea.. quick question. thanks
Printable View
how do i read the last line of a document and put it into an array?
double lastLine = code for reading last line;
myArray.SetValue(lastLine, 0);
something like that?.. yea.. quick question. thanks
To read the last line of a file using a StreamReader you must first read every other line because a StreamReader is forward-only. There is no way to know how many lines it contins without reading them. The StreamReader's Peek method returns -1 when there is no data remaining, so you can just read a line into a variable in a loop until Peek returns -1. Then the value in the variable is the last line.
thank you so much!!!!!! it works now!!! *rates post*
Edit: I must go around and spread other rep first? What if jmc is the only one who helps me VBForums, huh?! huh?!!?!
lol.. sorry jmc =/
I don't do it for the rep. I do it for the money that you send me completely voluntarily. ;)
hehe.. right.... ;)