StreamReader sr = File.OpenText("E:\\test.txt");
string row;
do
{
row = sr.ReadLine();
textBox.Text = row;
}
while (!(row == null));
sr.Close(I can not use ReadToEnd method)
What im doing wrong?
thanks in advancedSince the textBox can hold only one line read from the file, it will display only the last line which will be null. What exactly are your trying to do - display the entire file in textBox?
yes exactly.. hmm.. in that case only loop statement wont work - and feel so i also can not data reader to get rows (once data source is a text file), right?
what I'm trying to do: I need to delete all blank rows from that text file - and to do that I was wondering to apply a substring or a char variable in each row based on the 5th caracter position(if is blank the line is deleted)
any idea
0 comments:
Post a Comment