pagego Posted September 13, 2003 Posted September 13, 2003 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. Quote
aewarnick Posted September 13, 2003 Posted September 13, 2003 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 char's 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. Quote C#
*Experts* Bucky Posted September 13, 2003 *Experts* Posted September 13, 2003 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 you're storing (RichTextBox.TextRTF, for example). Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
*Experts* DiverDan Posted September 14, 2003 *Experts* Posted September 14, 2003 You might also save each textbox in an 1Darray, then serialize it, store it in a line format or a csv format, etc. I'm not the strongest at it but xml works also. Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
Jay1b Posted September 14, 2003 Posted September 14, 2003 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? Quote
*Experts* mutant Posted September 14, 2003 *Experts* Posted September 14, 2003 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.