How to get Available Disk Space in VB.Net

Posted by vishalneeraj-24503 under VB.NET category on | Points: 40 | Views : 2844
With the help of DriveInfo class and GetDrives static property of DriveInfo class,we can achieve.

GetDrives is used to retrieves the drive names of all logical drives.
DriveInfo class comes inside System.IO Namespace.

Dim drive_info() As IO.DriveInfo = IO.DriveInfo.GetDrives
For Each Drv In drive_info
If Drv.IsReady Then
MsgBox(Drv.Name & " " & Drv.AvailableFreeSpace.ToString)
End If

The IsReady property returns true if the drive is ready otherwise returns false if the drive is not ready.

AvailableFreeSpace property indicates the amount of free space in all the Drives i.e. C:\,D:\ and so on.

Comments or Responses

Login to post response