Tuesday 11 November 2014

Determine a File's Creation Time in Visual Basic

Determine a File's Creation Time in Visual Basic

To determine a file's creation time:
Use the GetFileInfo method to return a FileInfo object for the file, which can be queried for information. This example gets a FileInfo object for Testfile.txt and uses the CreationTime property to display the creation time.


    Dim infoReader As System.IO.FileInfo
    infoReader = My.Computer.FileSystem.GetFileInfo("C:\samplefile.txt")
    MsgBox("File was created on " & infoReader.CreationTime)