I am working with visual basic 2005 express edition, and I have a form with a list box on, how would I save items in a list box when the form closes and recall them when the form opens.
Thanks
I am working with visual basic 2005 express edition, and I have a form with a list box on, how would I save items in a list box when the form closes and recall them when the form opens.
Thanks
Saving and Recalling items in a list box
Timmy Dot Net
PLF
Roberto Icardi
The best one would be to save your list box items into a simple XML file.
It should have a structure like this:
<items>
<item>
<value>XYZ</value>
<text>dada</text>
</item>
</items>
Then when you close the form you simply write the XML file (Xml namespace) and when you load your form you read the XML and get all the items and add them to your list box.
slush_puppy
There you will find everything you need for working with XML files.
If you do a search on google, you will find many tutorials.
RichLeah
jamvir
Simple text file, XML, Configuration file, ...
Tako
Or you could iterate throuth the items and write them to a simple ASCII file, Database or even a delimited String which you could write into a application setting which you could retrieve when you next open the form.
Either way you'll need to write something to save and retrieve the data. A couple of questions which may determine where to store.
How many Items are we talking in he listbox
How many list boxes/forms are we looking