Determining Size of a File

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?
 
K

Klaus H. Probst

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".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top