Solved

Save User Settings

Posted on 2004-09-11
4
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

623 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