Display a list of files

G

Guest

I need to get a list of files in a directory, say c:\temp, and display it in
a drop down list. How would I do that?
 
G

Guest

Thanks, that works. Now I want to display the list sorted by date, so that
the most recent date is at the top of the list and automatically selected in
the drop down list. how would I do that?
 
M

Mark Rae [MVP]

Thanks, that works. Now I want to display the list sorted by date, so
that the most recent date is at the top of the list

There's no built-in way to do that just with the GetFiles method. However,
what you require is easily achieved by adding the results to a generic and
sorting that:
http://blogs.msdn.com/markda/archive/2006/04/20/580075.aspx
and automatically selected in the drop down list.

Unless you specify otherwise, the first item in your DropDownList will be
selected by default.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top