Saving controls

  • Thread starter Thread starter Mark_B
  • Start date Start date
M

Mark_B

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?
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top