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
Clara Duta
NA
1
1.2k
Highlight words in multiple files
Aug 17 2012 1:16 PM
Hey everyone. What I want to do and don't know how is to find and highlight these 2 words "game" and "player" in .txt files.
No richtext.
so mostly like this code:
private void button1_Click(object sender, EventArgs e)
{
this.openFileDialog1.Filter =
"TEXT (*.xml;*.txt|";
this.openFileDialog1.Multiselect = true;
this.openFileDialog1.Title = "My text editor";
DialogResult dr = openFileDialog1.ShowDialog();
if (dr == DialogResult.OK)
foreach (String file in openFileDialog1.FileNames)
try
{
StreamReader reader = new StreamReader(file);
string content = reader.ReadToEnd();
reader.Close();
content = Regex.Replace(content, "game", "gaming");
content = Regex.Replace(content, "player", "playing");
so mostly like this code, but not actually replacing the word, just find it and highlight it. Help ???
Reply
Answers (
1
)
transfering and converting from string to bool
IComparable.CompareTo