My.Computer.FileSystem.Drives Property
Returns a read-only collection of all available drive names.
' Usage
Dim value As System.Collections.ObjectModel.ReadOnlyCollection(Of System.IO.DriveInfo) = My.Computer.FileSystem.Drives
' Declaration
Public ReadOnly Property Drives As System.Collections.ObjectModel.ReadOnlyCollection(Of System.IO.DriveInfo)
Property Value
System.Collections.ObjectModel.ReadOnlyCollection (of System.IO.DriveInfo)
Exceptions
This property throws no exceptions.
Remarks
This property returns all logical drives.
Tasks
The following table lists examples of tasks involving the My.Computer.FileSystem.Drives property.
To |
See |
---|---|
Determine a drive's volume label |
|
Determine a drive's format |
|
Determine a drive's type |
|
Determine a drive's total space |
|
Determine a drive's free space |
How to: Determine a Drive's Physical Free Space in Visual Basic |
Determine a drive's root directory |
Example
This example displays the available drive names in a message box.
Dim getInfo As System.IO.DriveInfo()
getInfo = System.IO.DriveInfo.GetDrives
For Each info As System.IO.DriveInfo In getInfo
MsgBox(info.name)
Next
Requirements
Namespace:Microsoft.VisualBasic.MyServices
Class:FileSystemProxy (provides access to FileSystem)
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
Availability by Project Type
Project type |
Available |
---|---|
Windows Application |
Yes |
Class Library |
Yes |
Console Application |
Yes |
Windows Control Library |
Yes |
Web Control Library |
Yes |
Windows Service |
Yes |
Web Site |
Yes |
Permissions
The following permission may be necessary:
Permission |
Description |
---|---|
Controls the ability to access files and folders. Associated enumeration: Unrestricted. |
For more information, see Code Access Security and Requesting Permissions.
See Also
Reference
System.Collections.ObjectModel.ReadOnlyCollection<T>