Question

how can i calculate the total disc space available + free space + used space in the DVD/CD inserted in f-drive.. and display the result on the label...

Was it helpful?

Solution

using System.IO;

DriveInfo fDrive = new DriveInfo(@"F:\");
Console.WriteLine(fDrive.AvailableFreeSpace);
Console.WriteLine(fDrive.TotalSize);

For other properties, check this link to MSDN

OTHER TIPS

Use GetDriveInfo from the FileSystem class. You need to reference the Microsoft.VisualBasic DLL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top