O'Reilly logo

Developing Microsoft® .NET Controls with Microsoft Visual Basic® .NET by John Connell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Right Tool for the Right Job

The sample program does show the drives using the .NET Framework and managed code, but I’m sure you’ll agree that this attempt is a little unsatisfying. Maybe I’m spoiled, but I prefer to get at least all the information about the drive that was available with FileSystemObject. To do this, I could make an API call to the GetDriveType and GetVolumeInformation methods of Kernel32.dll. But that’s also unmanaged code, and I’d have to build a data structure to hold the information—and that would require me to type.

It turns out that there’s a much better way to get all the drive information I want (and more) by using the seldom-used System.Management namespace in the .NET Framework. By tapping into this well-kept ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required