Solved

Save new lists at runtime.

Posted on 2009-05-18
6
195 Views
Last Modified: 2013-11-25
Hi all.
I have to come up with a way to save new lists in a program, but not use a database. I am thinking about My.Settings. How do you make a new stringcollection in the My.Settings? Also open to a diff approach. I will be using a listbox for the source.
0
Comment
Question by:Hawkvalley1
  • 4
  • 2
6 Comments
 
LVL 12

Expert Comment

by:needo_jee
ID: 24418262
hi,
as per requirements there could be many ways to do this, however if there is only one list or a fixed number of lists (eg 3 or 4 or not very much in number) then you may use appSettings to hold these lists otherwise it would be better to write on file system in xml files.

your data is already in dataTables? perhaps. if so , just use datatable.writexml(<filename>,with schema)

if the lists are unique, then use that name for files on file system or give some details to let us provide better options.

-thanks
0
 
LVL 9

Author Comment

by:Hawkvalley1
ID: 24418384
I have no idea as to how many lists there will be, that will be up to the User and they are built at runtime in one form and the data will be used in a diff form to populate listboxes and comboboxes. I don't expect it to be a high number maybe close to 10 lists at the max and maybe up to 20 items in each list. No dataTables, but it is an interesting idea.
0
 
LVL 9

Author Comment

by:Hawkvalley1
ID: 24418440
The other catch is there will be several list that that will be called by the choice of the first list item. My program will already have a directory for other files, so file based will not be a problem.
0
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.

 
LVL 9

Author Comment

by:Hawkvalley1
ID: 24421655
So how do you make a My.Settings.StringCollection at runtime?
0
 
LVL 12

Accepted Solution

by:
needo_jee earned 500 total points
ID: 24428205
hi

though I would prefer to save lists as xml files and then creating a catalog xml file to hold names and path of all other files/lists.

but as per your requirement, here is a link that explains how to add remove keys in configuration files at runtime.

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/d68a872e-14bc-414a-82c4-d1035a11b4a8

hope, it would help you

-thanks
0
 
LVL 9

Author Comment

by:Hawkvalley1
ID: 24436377
Well it has been a little while since I heard from you. I am not familiar with xml files and this might have been/still could be an option. What I came up since then is a simple comma separated text file that either just gets read and fills the listboxes/comboboxes or is emptied and reset with a new list if needed. I might need the above link in the future. Do you think xml would be a better choice than what I have, if so it would require more time on your part to teach me the layout and calling the files to load them. I will be encrypting the file which I already understand how to do with text files. I guess my initial concern with IO was the Users machine may have restrictions - but they will just to give my program the permissions for IO-Read/Write. Hope this all makes since. The basic layout is they will build the catalog and then fill the catalog items with lists of strings, my program will then take these lists and populate diff. controls with the data. Thanks for getting back with me.
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

Title # Comments Views Activity
Format column on datatable 7 29
Help with converting data format in xml file using VB.NET 11 54
Problem to With line 4 43
Advice in Xamarin 21 57
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

867 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

19 Experts available now in Live!

Get 1:1 Help Now