Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

Right now I'm able to read the textfile line by line until end of line..here are the code

VB
Dim Reader As StreamReader = File.OpenText("C:\Test.txt")
Dim FileText As String = Reader.ReadToEnd()
Reader.Close()
txtTest.Text = FileText


after it read all line, user able to edit the line and save the new data. But how can I clean the content of the textfile before I write the new data on it? I try to search on google but not find the right solution. So could someone help me on this?
I dont want to delete the file and create new one. I want to use the current textfile and..you know what I mean. Please advise me on this
Posted
Comments
Sergey Alexandrovich Kryukov 31-Jan-13 23:31pm    
How about just reading help more thoroughly? :-)
—SA
Luiey Ichigo 31-Jan-13 23:43pm    
haha..I'll try to read first and feedback to you what I'm see through the page..tq
Sergey Alexandrovich Kryukov 31-Jan-13 23:54pm    
OK, did you read my answer? This is all you need. 100% a solution...
—SA
Luiey Ichigo 31-Jan-13 23:56pm    
Yeah sir..I'll look forward on it
Sergey Alexandrovich Kryukov 1-Feb-13 0:07am    
Very good. When and if you see it makes sense, please accept the answer formally (green button), if not, ask what's not clear, I'll gladly answer.
—SA

1 solution

Look here: http://msdn.microsoft.com/en-us/library/system.io.streamwriter.aspx[^].

Now, locate the section "Constructors". Look through the help pages for the constructors, but only those having a Boolean parameter. Read about this parameter in any of those page. This parameter is your solution.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900