Go Back   RunUO - Ultima Online Emulation > Developer's Corner > Programming > C#

C# C# Discussion

Reply
 
Thread Tools Display Modes
Old 07-02-2006, 02:25 PM   #1 (permalink)
Forum Expert
 
Join Date: Jul 2003
Location: Arizona
Age: 18
Posts: 3,148
Send a message via AIM to Storm33229 Send a message via Yahoo to Storm33229
Default Saving/Loading

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:
Originally Posted by Radwen
You should crush your pills and sniff them.
Storm33229 is offline   Reply With Quote
Old 07-02-2006, 06:54 PM   #2 (permalink)
Forum Expert
 
TheOutkastDev's Avatar
 
Join Date: Sep 2002
Location: Houston, Texas
Age: 21
Posts: 3,933
Default

I am not 100% sure I understand what you're trying to accomplish. Could you explain in more depth please?
TheOutkastDev is offline   Reply With Quote
Old 07-02-2006, 07:27 PM   #3 (permalink)
Forum Expert
 
Join Date: Jul 2003
Location: Arizona
Age: 18
Posts: 3,148
Send a message via AIM to Storm33229 Send a message via Yahoo to Storm33229
Default

Quote:
Originally Posted by TheOutkastDev
I am not 100% sure I understand what you're trying to accomplish. Could you explain in more depth please?
Basic Idea: I want to be able to save/load information to/from a file. And display it on the form.

-Storm
__________________
Quote:
Originally Posted by Radwen
You should crush your pills and sniff them.
Storm33229 is offline   Reply With Quote
Old 07-02-2006, 07:39 PM   #4 (permalink)
Forum Expert
 
TheOutkastDev's Avatar
 
Join Date: Sep 2002
Location: Houston, Texas
Age: 21
Posts: 3,933
Default

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.
TheOutkastDev is offline   Reply With Quote
Old 07-05-2006, 03:39 PM   #5 (permalink)
Forum Expert
 
Join Date: Jul 2003
Location: Arizona
Age: 18
Posts: 3,148
Send a message via AIM to Storm33229 Send a message via Yahoo to Storm33229
Default

Quote:
Originally Posted by TheOutkastDev
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.
That's what I want to do. But problem is I don't know how to do it. And I keep looking it up, and all the code is very irrelivant to what I am doing + very messy. So if you have any GOOD links to stuff pertaining to that specifically it'd be much appreciated if you posted them or... even better, if you wanted to write up an example but I won't ask that of you.

Thx
-Storm
__________________
Quote:
Originally Posted by Radwen
You should crush your pills and sniff them.
Storm33229 is offline   Reply With Quote
Old 07-05-2006, 05:56 PM   #6 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,909
Default

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.
mordero is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5