この機能をお借りしています。必要に応じてさらに操作できる情報をデータテーブルに入力することで、非常に簡単になります。
gridview.DataSource = Fileinfo_To_DataTable("mypath")
Private Function Fileinfo_To_DataTable(ByVal directory As String) As DataTable
Try
'Create a new data table
Dim dt As DataTable = New DataTable
'Add the following columns: Name. Length Last Write Time, Creation Time
dt.Columns.Addrange({New DataColumn("Name"), New DataColumn("Length", GetType(Long)), New DataColumn("Last Write Time", GetType(Date)), New DataColumn("Creation Time", GetType(Date))})
'Loop through each file in the directory
For Each file As IO.FileInfo In New IO.DirectoryInfo(directory).GetFiles
'Create a new row
Dim dr As DataRow = dt.NewRow
'Set the data
dr(0) = file.Name
dr(1) = file.Length
dr(2) = file.LastWriteTime
dr(3) = file.CreationTime
'Add the row to the data table
dt.Rows.Add(dr)
Next
'Return the data table
Return dt
Catch ex As Exception
Console.WriteLine(ex.ToString)
'Return nothing if something fails
Return Nothing
End Try
End Function