TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
thiago costa
NA
319
0
Find text, in .txt file, replace with nothing (remove line)
Jul 2 2013 9:10 AM
Hello there guys...
I have a text file called online.txt.
each time the program executes, it will append a new line of text. works 100%.
Now, what I am trying to acomplish, is: Everytime the program closes I want to replace _user with an empty line.
When I say empty line, I mean the line doesn't exist...
I tryed this: Doesnt work.
try
{
this.EndInvoke(this.BeginInvoke(new MethodInvoker(delegate()
{
String strxFile = File.ReadAllText("online.txt");
strxFile = strxFile.Replace(_user, null);
File.WriteAllText("online.txt", strxFile);
})));
}
catch
{ }
I tryed this too: strxFile = strxFile.Replace(_user, "");
Doesnt work... both commands above will leave the line existing, with no string in it..
The real story is, I want to delete the line 100% like the line is not there.
Thanks Guys.
Reply
Answers (
6
)
Problem with installing the windows form application
Validation for mastercard