Tuesday, 11 November 2014

Determine a Drive's Physical Free Space in Visual Basic

Determine a Drive's Physical Free Space in Visual Basic

To determine the amount of free space on a drive
 Use the TotalFreeSpace property to determine the amount of free space, as illustrated in the following code:

    Dim cdrive As System.IO.DriveInfo
    cdrive = My.Computer.FileSystem.GetDriveInfo("C:\")
    MsgBox("Total free space: " & CStr(cdrive.TotalFreeSpace))