Public Class Form1の全コード
Public Class Form1
Private Sub browseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles browseButton.Click
Dim i As Integer 'カウント変数生成
'FolderBrowserDialogを開く
If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
'変I数fileNamesをSystem.Collections.ObjectModel.ReadOnlyCollection(Of String)型で生成
Dim fileNames As System.Collections.ObjectModel.ReadOnlyCollection(Of String) _
= My.Computer.FileSystem.GetFiles(FolderBrowserDialog1.SelectedPath, FileIO.SearchOption.SearchAllSubDirectories, "*.*")
'変I数OutTextをString型で生成
Dim OutText As String = "Size:bytes " & vbTab & "Modified: " & vbTab & "File: " & vbCrLf
'fileNames.Count - 1まで繰り返し
For i = 0 To fileNames.Count - 1
'変I数thisFileをSystem.IO.FileInfo型で生成
Dim thisFile As System.IO.FileInfo = My.Computer.FileSystem.GetFileInfo(fileNames(i))
'変I数OutTextにSizeとModifiedとFileNameを加算
OutText = OutText & thisFile.Length.ToString & vbTab & thisFile.LastWriteTime.ToString & vbTab & thisFile.FullName & vbCrLf
Next i
'SaveFileDialogを開く
If SaveFileDialog1.ShowDialog() = DialogResult.OK Then
'OutTextの内容をファイルに出力
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName, OutText, append:=False)
End If
End If
End Sub
End Class