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?

Recommended Answers

All 3 Replies

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

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

I guess it's solved. All that I needed are here. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.