开发者

Files in DatagridView

开发者 https://www.devze.com 2023-04-12 10:16 出处:网络
How can I show files and their path in DataGridView without using web page? I want to display all sub folders of file I\'ve selected with FolderBrowserDialog in one column and their path in second co

How can I show files and their path in DataGridView without using web page? I want to display all sub folders of file I've selected with FolderBrowserDialog in one column and their path in second column. I tried to found out how it's possible, but I've found only examples in VB.net and they were using web pages for it. I want to use WinForm for display th开发者_Python百科e data.

Thanks for responses.


To get list of files and folders use the methods of System.IO.DirectoryInfo or System.IO.Directory class.

var result = from file in 
                   new System.IO.DirectoryInfo(@"c:\").EnumerateFileSystemInfos()
                   select file;

dataGridView1.DataSource = result.ToList();
0

精彩评论

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