What is the correct way to save data in forms

What is the standard convention to save data in textboxes and other form data to be loaded the next time the program is opened?

asked Aug 2, 2010 at 4:00 2,286 5 5 gold badges 26 26 silver badges 39 39 bronze badges

I have always done it by making an object and then storing my data into that object and serializing it to an XML file. But I guess to rephrase my question what is the way that most programs in "all programs" do this? If I search through the directories I don't see many xml files saving the forms last position on screen or the forms size.

Commented Aug 2, 2010 at 16:54

4 Answers 4

I personally do not know of any convention, however you could look into the following methods:

answered Aug 2, 2010 at 4:04 8,740 15 15 gold badges 79 79 silver badges 119 119 bronze badges

Not sure of the standard convention, or if there is one, but saving to a text file would be a simple-to-implement solution.

answered Aug 2, 2010 at 4:02 3,205 6 6 gold badges 33 33 silver badges 49 49 bronze badges

It depends on the kind of data that you are trying to save. If this is a relatively small amount of user specific data associated with their user preferences, then user settings are the way to go.

If this is large amount of application data (for example like an entire address book), then you are probably better off writing to an external file or database in whatever format suits your needs.

answered Aug 2, 2010 at 4:08 978 1 1 gold badge 6 6 silver badges 12 12 bronze badges

You should be looking at Windows Forms data binding - that is the best way to save data from and reload data into a Windows Forms application. Once you have set up your form controls for data binding, you have a choice of where to store the data, as explained here.

answered Aug 2, 2010 at 4:16 Paul Keister Paul Keister 13k 5 5 gold badges 47 47 silver badges 77 77 bronze badges

Related

Hot Network Questions

Subscribe to RSS

Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2024 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2024.9.4.14806