Solved

Save User Settings

Posted on 2004-09-11
4
195 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

929 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now