473,320 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Saving controls

I have an unpredictable number of RichTestBoxes, stored in a generic list,
that are created at runtime. Currently, I am saving these controls to a file
by saving each attribute of each box in string form using a streamwriter.
Later, these attributes are read from the file with a streamreader and the
controls are recreated.

It seems like a cumbersome, inelegant, and inefficient way to save. Is there
another way of saving the entire instance of a control (or any class) in one
shot?

Sep 19 '08 #1
1 1235
For serializable classes you can write them directly to the stream with a
BinaryFormatter. However, if would prefer the option you have taken as it
decouples you from the RichTextBox as when you move to WPF you would be able
to make it the WPF textbox without changing your code much and without having
to write a converter to convert the saved files.
(This is required as serialized classes need to be reloaded to the same
implementation of the same class)
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Mark_B" wrote:
I have an unpredictable number of RichTestBoxes, stored in a generic list,
that are created at runtime. Currently, I am saving these controls to a file
by saving each attribute of each box in string form using a streamwriter.
Later, these attributes are read from the file with a streamreader and the
controls are recreated.

It seems like a cumbersome, inelegant, and inefficient way to save. Is there
another way of saving the entire instance of a control (or any class) in one
shot?
Sep 19 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mahesh Devjibhai Dhola [MVP] | last post by:
Hi, User can adjust the size of columns of a table or the position of splitter in UI. We want these adjustments to be remembered when we restart the application. Currently, we are saving these...
3
by: RCS | last post by:
I have an app that I have different "sections" that I want to switch back and forth from, all while having the server maintain viewstate for each page. In other words, when I am on Page1.aspx and...
0
by: DKode | last post by:
Hello, I am trying to call a UserControl after postback to save data filled out on that usercontrol to sql server. The problem I am having is this, I have 2 LinkButtons that I have setup as...
15
by: Dan DeConinck | last post by:
Hello, I want to save the position of all the controls on my form. I would like to write them out to a preference file. I have done this in DOS BASIC like this: TO WRITE the preference...
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
6
by: Mark Denardo | last post by:
My question is similar to one someone posted a few months back, but I don't see any replies. Basically I want to be able to have users upload photos and save them in a database (as byte data)...
1
by: nmahesh567 | last post by:
Hi All, I have a following task to be implemented in my project and I would like to know ideas and best possible solution with little code from you guys. Please let me know and any help would be...
9
by: Wingot | last post by:
Hey, I am using Visual Studio 2008 Beta 2 for some application development in C#, but I presume that the following question applies equally well to any environment.
0
jgroos
by: jgroos | last post by:
Hi! I'm creating a C# application that allows the user to add controls (custom user controls) at run-time. Is there a standard way to go about saving the controls (location, etc.) so that upon the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.