PDA

Click to See Complete Forum and Search --> : Collection class Saving


Cabal
Jan 22nd, 2000, 05:32 AM
I am programming a school project and need to save the data within a collection to a text file (I am not allowed to use access databases) and retrieve it, i would appreciate some help..


thankyou in advance

mcleran
Jan 22nd, 2000, 09:20 PM
What data are you trying to retrieve? Is it just collection members or is it data about each collection member? To loop thru a collection, you can use the For Each ..Next like so:

Dim frm As Form

For Each frm In Forms
Debug.Print frm.Name
Next frm

This code will loop thru all forms in the Forms collection and print their name to the debug window. If you're defining your own collections, just substitue your object type instead of frm. You can then loop thru every object in your collection and write any object property you want to a text file. See MSDN help on the FileSystemObject and TextStream object for writing to a text file.


Hope this helps,

Dan

Cabal
Jan 23rd, 2000, 12:56 AM
thanks, i used a filesystemobject to save the collection data to a text file thankyou ,again