Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Save User Settings

Posted on 2004-09-11
4
Medium Priority
?
214 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

661 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