|
-
Nov 10th, 2000, 05:35 AM
#1
Thread Starter
Hyperactive Member
Im only want he cd to be displayed in the drivelistbox?? Is there any way to manage this??
-
Nov 10th, 2000, 11:09 AM
#2
Lively Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|