G
Guest
I have been working on a project to Search and Replace text within files. The
project includes automatic file backups and date by date file restores. I use
a richtextbox to display the text with color formatting where search strings
have been found. This way I can highlight multiple search finds at the same
time, unlike a textbox.
To be efficient I load the files that have found strings into an array and
display the names of these files in a listbox. Once the listbox is clicked
the file loads from the appropriate index in the array into the richtextbox
and formats the text where strings have been found. If any changes are made
to the richtextbox via the automatic replace or a manual change they are
saved back to the array and marked as changed so that they can be saved back
to the file when the users chooses. Importantly they are saved back to the
array as richtext and no longer plain text and thus the problem arises.
I am aware that richtextboxes have a savefile function that allows them to
save their info as PlainText but this seems to be the ONLY way to get data
out of them as plain text and I don’t want to rush the user to save each file
as they make changes. Also I think that it is inefficient to load the array
back into the richtextbox for each file as the save process is completed when
there could be potentially hundreds of files to be saved. For the same reason
I’m not sure opening hundreds of child forms would be any better. I'm trying
to avoid using too much resources but I have found no other way to get
richtextformat to save as plain text without the funky formatting. Of course
convert types do no address this matter since being richtextformat is not an
argument of being a string or not.
I have seen other control types that can do much more sophisticated
highlights than even a richtextbox has to offer. For example just bring up a
found search topic in .net and you will see highlighted text etc. I've
attempted to set something up via HTML but I'm not too savvy with that and
after a futile attempt thought that I might ask here before investing loads
of time researching if HTML was even the way to go. After all my interface
must be able to accept changes by the user and convert that back to plain
text without any formatting of any kind introduced to the file.
I'm just a sole developer lost in the universe of .net
Somebody please help. There has to be a better solution to this problem.
project includes automatic file backups and date by date file restores. I use
a richtextbox to display the text with color formatting where search strings
have been found. This way I can highlight multiple search finds at the same
time, unlike a textbox.
To be efficient I load the files that have found strings into an array and
display the names of these files in a listbox. Once the listbox is clicked
the file loads from the appropriate index in the array into the richtextbox
and formats the text where strings have been found. If any changes are made
to the richtextbox via the automatic replace or a manual change they are
saved back to the array and marked as changed so that they can be saved back
to the file when the users chooses. Importantly they are saved back to the
array as richtext and no longer plain text and thus the problem arises.
I am aware that richtextboxes have a savefile function that allows them to
save their info as PlainText but this seems to be the ONLY way to get data
out of them as plain text and I don’t want to rush the user to save each file
as they make changes. Also I think that it is inefficient to load the array
back into the richtextbox for each file as the save process is completed when
there could be potentially hundreds of files to be saved. For the same reason
I’m not sure opening hundreds of child forms would be any better. I'm trying
to avoid using too much resources but I have found no other way to get
richtextformat to save as plain text without the funky formatting. Of course
convert types do no address this matter since being richtextformat is not an
argument of being a string or not.
I have seen other control types that can do much more sophisticated
highlights than even a richtextbox has to offer. For example just bring up a
found search topic in .net and you will see highlighted text etc. I've
attempted to set something up via HTML but I'm not too savvy with that and
after a futile attempt thought that I might ask here before investing loads
of time researching if HTML was even the way to go. After all my interface
must be able to accept changes by the user and convert that back to plain
text without any formatting of any kind introduced to the file.
I'm just a sole developer lost in the universe of .net
Somebody please help. There has to be a better solution to this problem.