Save Multiple Text Files

pagego

Active member
Joined
Jan 30, 2003
Messages
27
Location
Milwaukee, WI
Hey, I am looking for a way to save a few strings or integers as settings for an application, as well as multiple rich text files. I am looking to save all of this in one file and to have it be easy to retrieve each section of the file. Any suggestions? Thanks in advance for your help.
 
Yes, this would not be hard. Just create a text file with your app using StreamWriter and read it using StreamReader. Just create in your file certain tags. Loop through each char in the text file and when you find a tag, mark the index in a int valriable then find the ending tag. Ex: [ ] Mark that index and read the chars inbetween.

If it is what you want, use the end tag index and read the info inbetween it and the next tag or line.

You can do this any creative way you want. Just learn to create and manipulate text and to search through it.
 
You could also [mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/cpguide/html/cpovrserializingobjects.htm]use serialization[/mshelp] of a class that stores all the
settings and documents. To store the rich text files in the
class, just set some String properties to the RTF text youre
storing (RichTextBox.TextRTF, for example).
 
You might also save each textbox in an 1Darray, then serialize it, store it in a line format or a csv format, etc. Im not the strongest at it but xml works also.
 
Sorry to gate crash the thread. But am i right in thinking that serialization kind of export the current frame to a file - so you can reload it back at a later date?
 
Originally posted by Jay1b
Sorry to gate crash the thread. But am i right in thinking that serialization kind of export the current frame to a file - so you can reload it back at a later date?
Serialization is capturing the current state of any object that is marked as Serializable to the file so you can restore it later to excatly the same state.
 
Back
Top