Determining Size of a File

  • Thread starter Thread starter Phil Galey
  • Start date Start date
P

Phil Galey

In VB.NET I find the IO object very handy in replacing most of the
functionality of the FileSystemObject. One exception, however, is in
determining the size of a file. How can you determine the size of a file in
VB.NET without adding the FileSystemObject to your project?
 
Imports System.IO
....

Dim fi As New FileInfo(somepath)

Then get the information from the FileInfo object. In keeping with the
abstraction-of-the-month buzz, the property you want is "Length", not
"Size".
 
Back
Top