The steps to get the result as below:
1. Get the collection of FileInfo for each file in the directory/drive by using function explained in "Retrieve All Files Info in the specified Folder (Using LINQ To Object)" blog
2. Add the DataGridView component in the form name it anything say DataGridView1
3. Add the following string in the action corresponding to which data grid is needed to be filled with the file information:
Dim arrList as New ArrayList
getCompleteFileList1(directoryName, arrList)
dataGridView1.DataSource= arrList
Or If only specific list of attributes for each file is needed to be displayed the the following lines can be considered:
Dim arrList As New ArrayList
getCompleteFileList1(directoryName, arrList)
Dim filesInfo = From file As IO.FileInfo In arrList _
Select file.Name, file.DirectoryName, file.Length, file.LastWriteTime
dataGridView1.DataSource = filesInfo.ToList
No comments:
Post a Comment