开发者

WinForm control to list files in a directory

开发者 https://www.devze.com 2022-12-13 22:14 出处:网络
I\'m new to the WinForms control toolbox, so I\'m look开发者_开发技巧ing to get suggestions on which control I should use for the following simple situation:

I'm new to the WinForms control toolbox, so I'm look开发者_开发技巧ing to get suggestions on which control I should use for the following simple situation:

I want to have an area on my form that shows a list of the files in a particular directory.

My first quick and dirty inclination is to put a textbox on the form and populate it line-by-line using Directory.GetFiles() - but I know there has to be a more appropriate control. Maybe gridview?

(.NET 3.5)


ListView would be the preferred control. That way you can click on each file name individually, for highlighting/copying, etc

You would also be able to have multiple columns in detail view, and set up sorting on file size, date created, type, etc.

Another advantage of ListView is that you can select multiple items. I use this to delete or open a group of files instead of just one at a time, very handy.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号