Guys, I can't still figure out how to show to a user the file info of a file programamtically. Can I just use the Properties window that Windows use to show all the detals of a file (e.g. name, type, size, path, date created ect.)
I am using the IO namespace, can anyone help me please?

6 Years
Discussion Span
Last Post by markdean.expres

Try this :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim Info As New FileInfo("D:\000.jpg")
    MsgBox("Name : " & Info.Name & vbCrLf & _
        "Length : " & Info.Length & " bytes" & vbCrLf & _
        "Type : " & Info.Extension & vbCrLf & _
        "Date Created : " & Info.CreationTime & vbCrLf & _
        "Path : " & Info.DirectoryName & vbCrLf & _
        "Full Path : " & Info.FullName)
End Sub

Edited by Jx_Man: n/a


You can use the FileInfo class or the FileAttribute.
FileInfo has most of what you'll be looking for.

Imports System.IO
Module Module1

   Sub Main()
      Dim strInFile As String = "c:\science\test.txt"
      Dim fa As FileAttribute = File.GetAttributes(strInFile)
      Dim fi As New FileInfo(strInFile)
   End Sub
End Module
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.