Changes the current drive.
Required. String expression that specifies an existing drive. If you supply a zero-length string (""), the current drive doesn't change. If the Drive argument is a multiple-character string, ChDrive uses only the first letter.
|Exception type||Error number||Condition|
Invalid drive is specified, or drive is unavailable.
See the "Error number" column if you are upgrading Visual Basic 6.0 applications that use unstructured error handling. (You can compare the error number against the.) However, when possible, you should consider replacing such error control with .
The ChDrive function requires unmanaged-code permission, which may affect its execution in partial-trust situations. For more information, see SecurityPermission Class and .
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)