LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically load files

Solved!
Go to solution

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

0 Kudos
Message 1 of 8
(3,622 Views)

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.

Message 2 of 8
(3,612 Views)

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

regards

0 Kudos
Message 3 of 8
(3,607 Views)

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).

0 Kudos
Message 4 of 8
(3,605 Views)
Solution
Accepted by topic author ViperNaples

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?
Message 5 of 8
(3,598 Views)

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.

0 Kudos
Message 6 of 8
(3,595 Views)

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

0 Kudos
Message 7 of 8
(3,588 Views)

Wolfgang, i use the function in this way:

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

 

0 Kudos
Message 8 of 8
(3,587 Views)