cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically load files

SOLVED
ViperNaples
Member
Solved!

Automatically load files

Hello, is there a way to load files (which are in a given folder) in a listbox automatically at startup of my program?
And perhaps can also delete automatically the contents of that folder when you exit the program?

Thanks

7 REPLIES 7
Wolfgang
Trusted Enthusiast

Re: Automatically load files

You can use the functions GetFirstFile and GetNextFile to obtain all files with a given search path. The file names can then be inserted into a listbox using InsertListItem.

ViperNaples
Member

Re: Automatically load files

I'll try and let you know.
thank you very much

regards

ViperNaples
Member

Re: Automatically load files

Wolfgang Sorry, but I can not make it work. The files that are in the folder C: \ TEST all have the same extension (*. dxf), but I don't know their full name ... the program should recognize their name and add them in the listbox (using their own name).

Highlighted
RobertoBozzolo
Proven Zealot
Solution

Re: Automatically load files

Message contains a hyperlink

Hello ViperNaples,

this example should be what you are looking for; it is more complete than what you have described, as it scans also for subdirectories and lists their content also.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Wolfgang
Trusted Enthusiast

Re: Automatically load files

How did you use the functions?

For example, GetFirstFile ( "*.dxf", 1, 1, 1, 1, 1, 1, fileName ); returns the first file name matching your search critereon in fileName.

ViperNaples
Member

Re: Automatically load files

Grazie Roberto, darò un'occhiata all'esempio. I tuoi consigli sono sempre utilissimi Smiley Wink

ViperNaples
Member

Re: Automatically load files

Wolfgang, i use the function in this way:

GetFirstFile ("c:\\TEST", 1, 0, 0, 0, 0, 0, nameFile);