Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

I want to compare two files (data imported in RichTextBoxes). And I want to add a particular sentence after every occurrence of a particular word.

So say suppose, I have to find the word chronology. SO it will first compare whether the word is there or not in both the files. If yes then it will add "<This is the word>", a line above where the word is written.

This will go on till the end of the file.

Please help.

Regards
Aman Chaurasia

What I have tried:

I have already imported 2 files in RichTextBoxes and now have to process the above mentioned event.
Posted
Updated 30-May-18 3:20am

1 solution

You have already posted this question at How do I create a viewer in C#?[^]; please do not repost.
 
Share this answer
 
Comments
Primo Chalice 31-May-18 2:44am    
That article is closed as it was not clear (as shown to me in the notification), so I had to post this.

Please help.
Richard MacCutchan 31-May-18 3:23am    
Read the file line by line into a string
Test if the string contains the word in question
If it does, then split the text at the space following the word
Combine the first part, the new sentence, and the second part
Add the string to the text box
Repeat until end of file

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