Siebel VB Language Reference > VB Language Reference >

ChDrive Statement


This standard VB statement changes the default drive.

Syntax

ChDrive drive

Argument
Description

drive

A string expression designating the new default drive

Returns

Not applicable

Usage

A colon is permitted but not required as part of the name of the drive; a single letter suffices. The drive to be made the default must exist and must be within the range specified by the LASTDRIVE statement in the config.sys file. If a null string ("") is supplied as the argument, the default drive remains the same. If the drive argument is a string, ChDrive uses the first letter only. If the argument is omitted, an error message is displayed. To change the current folder on a drive, use ChDir.

Example

This example changes the default drive to A.

Sub Button_Click
   Dim newdrive as String
   newdrive = "A"
   If Left(CurDir,2)  <>  newdrive then
      ChDrive newdrive
   End If
End Sub

Related Topics

ChDir Statement
CurDir Function
Dir Function
MkDir Statement
RmDir Statement

Siebel VB Language Reference Copyright © 2006, Oracle. All rights reserved.