|
||
|
|
#1 (permalink) | |
|
Forum Expert
|
Saving and Loading aka Serialization / De-Serialization (i think).
Variables: public int age; public string name; Forms: startForm // This is run on Main --Button : fillOutForm --Button : loadForm fillOutForm // This is where you fill out your age and name --Button : Ok // returns to startForm loadForm // displays all saved profiles (profile consists of name and age) --Button : Load a profile //Loads selected profile (selection is via radiobutton) Opens profile in viewForm viewForm // 2 labels displaying the loaded profile None of this is coded, why? Because I have no freaking idea on how to do it. I have tried googling it, and going to several sites. The problem? The problem is they have messy/complicated code that I don't want to have to read through just to figure it out. So, if anyone can show me code on how to do this (dont give me the actuall Form code) that would be awesome. -Storm
__________________
Quote:
|
|
|
|
|
|
|
#3 (permalink) | ||
|
Forum Expert
|
Quote:
-Storm
__________________
Quote:
|
||
|
|
|
|
|
#4 (permalink) |
|
Forum Expert
Join Date: Sep 2002
Location: Houston, Texas
Age: 21
Posts: 3,933
|
Well there's several ways you could do this.
The easiest: If you have C# Express 2005, you can use the built it settings designer to create application settings. From there, you can bind the values of specific settings to the various fields in the forms and vice versa. The not easiest: Use your own file i/o and hook the form's load and close events. When these events are invoked, you can read/write the file as necessary. |
|
|
|
|
|
#5 (permalink) | ||
|
Forum Expert
|
Quote:
or... even better, if you wanted to write up an example but I won't ask that of you.Thx -Storm
__________________
Quote:
|
||
|
|
|
|
|
#6 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,909
|
well you can save almost anything using XML and there are plenty of tutorials on how to read and write XML out there... if you cant find anything, ill try to find what i have (i think it was a function that was hardcoded to create an xml file with certain nodes and such, one for reading it, and one for updating it). Its kind of messy (i think lol), but it might be a good start for you if you cant find anything...
Edit: oh and you can start with the System.IO class to start reading and writing files... Edit 2: Found these in my favorites... http://www.dotnetspider.com/tutorial...roduction.aspx http://www.csharphelp.com/archives/archive199.html http://www.c-sharpcorner.com/Tutoria...utMellli21.asp Last edited by mordero; 07-05-2006 at 06:08 PM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|