I've exhausted my knowledge and ability to locate the answer on the net.. I need your help..... :'(

Im trying to write a program (obviously), that goes through a directory and records the name of every file, and prints it to a text file.

There's enough code to the program to not post it here, but if anyone needs to see it, i'll gladly put it up on 1 of those free code sharing sites (if i can remember the address...)

Basically, all of the program is done, except for the writing file names to a text file part :P

The program opens the file, and will write anything I specifically tell it to.
I know its browsing to the directory I want it to record, and the output directory is working as well. it just doesn't count the number of files, nor does it store file names into a variable.. But if I say "print #1, "Test"" it works fine.

My way of doing it is a for next loop. Its supposed to count the number of files (not folders) in a directory, and for i = 0 to (number of files in directory)

now since I want the program to be generic, and not have to manually enter the number of files... I need to know how to make the program count the number of files upon the "cmdWrite_click" event
and also I need to know how to put a file name into a variable.

if you have any ideas, please share!!!

Thanks guys