Im only want he cd to be displayed in the drivelistbox?? Is there any way to manage this??
Printable View
Im only want he cd to be displayed in the drivelistbox?? Is there any way to manage this??
Fairly simple in VB6 (not sure about anything else)
Add a list box called list1 and a drive box called drive1 to a form. In project->references tick the "Microsoft Scripting Runtime" reference and then add this code to your form
Option Explicit
Private Sub Form_Load()
Dim Counter As Long
Dim FS As New FileSystemObject
'Loop through the available drives
For Counter = 0 To Drive1.ListCount - 1
'If the drive type is a CD then
If FS.Drives(Left(Drive1.List(Counter), 1)).DriveType = CDRom Then
'Add this to the Listbox
List1.AddItem Drive1.List(Counter)
End If
'Next drive
Next
End Sub
Cheers
Chris