Solved

Save User Settings

Posted on 2004-09-11
4
202 Views
Last Modified: 2010-04-23
I still after reading several articles to save user prefernces am very lost.

These are the settings I need to save.

Image.Checkbox
Desc.Checkbox

Windows Program size

Heres the doozy:

I have a search form, as the user enter the field to search for.  If they choose to they can save that text to thier favorites.
Then I will have them click a favorite button(favbtn) that will display there saved strings.  When selected it will fill the txtbox for a search.

I just have a problem witht the saving of the favorites.  I would prefer and Ini file as it seems easier to use, or xml, but I would like to stay away from the registry.

Thanks for all the help, This site ROCKS.


MJ
0
Comment
Question by:malanois
  • 2
4 Comments
 
LVL 4

Expert Comment

by:Jigit
ID: 12037437
malanois, you are right  - XML seems to be reasonable solution. I would suggest the following schema:
<USERS>
  <USER username="john">
    <IMAGE></IMAGE>
    <DESCR></DESCR>
  </USER>
  <USER username="anny">
    <IMAGE></IMAGE>
    <DESCR></DESCR>
  </USER>
</USERS>

Samples for reading and writing XML:
http://samples.gotdotnet.com/quickstart/howto/doc/Xml/DOMInterfaceXmlDocument.aspx
http://www.devasp.com/search/display/category614.html

HTH,
Jigit
0
 

Author Comment

by:malanois
ID: 12038199
I have read thos before.

this is  a winforms program.

I still cannot get it to write or read

Thanks
MJ
0
 
LVL 4

Expert Comment

by:Jigit
ID: 12038497
It does not really matters whether it's WinForms or WebForms. Could you publish your source code here, I'll try to figure out what you did wrong.
0
 
LVL 2

Accepted Solution

by:
Mehrdad_Y earned 500 total points
ID: 12039110
I think
1- You have to add a Typed Dataset to your project. (From the solution explorer, Add a new item, DataSet)
2- Add a Table to it to define all the data you need to store. (Add an ELEMENT from the toolbox to your dataset, name it, then add your fields with data types)
3- Anytime you need to save some data, use the following code: (I assume, you name your dataset as DATASET1)
   Dim ds As New Dataset1
   Dim r As New Dataset1.Table1Row=ds.Table1.NewRow
   r.[Preference1]=[Value1]
   r.[Preference2]=[Value2]
   ...
   ds.Table1.Rows.Add(r)
   ds.WriteXML([FilePath])

4- Anytime you need to load the data, write the following code:
   Dim ds As New Dataset1
   ds.ReadXML([FilePath])
   [Value1]=ds.Table1.Rows([INDEX YOU NEED]).[Preference1]
   ....
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question