Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 6th, 2007, 11:54 PM
Registered User
 
Join Date: Apr 2007
Location: , , Australia.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alien13
Default User Setup, Help needed!

Hello, I'm new to C#, I started changing my program from AutoIt to C# last night, and I almost have the major features done.

There is one big problem that I am having at the moment. I don't know how to have an XML/INI/Etc file as the config file.
In my AutoIt version, I use a config.ini file that saves all the information.

My program is basically a hub. The user chooses what programs and websites they want to have in the program. They do this through the setup window. When they click the save button, everything gets written to the ini file.
Also, because there is an option for 5 programs they have to write a name in, and when they click save, the name is shown in a label.

So basically everything is written and read from this ini file. eg. the buttons and labels.

Here is my program so you know what I mean: hxxp://www.alien13.jumbahost.com/Launcher/WoW/CurrentVersion/Setup.rar

Is there a way to do this with C#. I have got the Setup window exactly the same, I just need to make it write to an XML or INI or whatever file and then have that information be read back so that the Launch buttons launch the programs selected, the names are shown next to each launch button, the website buttons launch the default browser and the written in website as well as display the sites name, and the Login button Launch world of warcraft and write in the username and password.

I hope that makes sense, If not just play around with my program above and you should get what I mean. Load in some programs and websites, click save and restart it. Go through the tabs on the main window and you will see how everything fits into place :)

Thanks alien13

New to C#
Known Languages:
AutoIt
English
German(Not much, but a bit)
  #2 (permalink)  
Old April 8th, 2007, 10:19 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I typically use object serialization to deal with config settings (whether they are readonly or read/write). Fortunately, the .NET framework provides some very easy methods for serializing and deserializing objects to and from XML. You can create a class that holds your settings (single global settings as well as setting collections/lists, such as your program list). Then you just serialize an instance of the class to disk. You don't have to write any code that processes XML directly, just let the framework do it.

Take a look at the XmlSerializer class to get an idea of where to start:

http://msdn2.microsoft.com/en-us/lib...erializer.aspx

-Peter
  #3 (permalink)  
Old April 10th, 2007, 06:15 AM
Registered User
 
Join Date: Apr 2007
Location: , , Australia.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alien13
Default

Hi Peter,

Thank you for the reply!
I'll have a look at the XmlSerializer class and see if I will be able to figure it out.

alien13(Nathan)

New to C#
Known Languages:
AutoIt
English
German(Not much, but a bit)
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Overwrite user page setup for printing peter2004 CSS Cascading Style Sheets 8 December 17th, 2007 05:51 PM
german web user needed to test IP detection code crmpicco PHP How-To 0 November 18th, 2007 01:19 PM
Help needed on creating User Friendly URLs minalarora ASP.NET 2.0 Professional 1 May 7th, 2007 07:19 PM
How to pass data to user interface (.NET Setup) saeedahmed C# 2 November 10th, 2005 06:48 AM
Basic setup help needed... dalin C# 2 November 4th, 2004 04:32 PM



All times are GMT -4. The time now is 02:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.