|
-
Jun 17th, 2005, 05:25 PM
#1
Thread Starter
Lively Member
Drive List Help [RESOLVED]
When I Choose The Option D:\ (CD Drive) and there is no Cd in the drive i get an error message,
is there a way to make it do nothing
Thanx
Lavarock09
Last edited by lavarock09; Jun 18th, 2005 at 05:30 AM.
-
Jun 17th, 2005, 05:38 PM
#2
Re: Drive List Help
Just by selecting it in the drive list box won't cause an error. In the code where you try to access the drive, you need to have an error handler.
Kinda like this :
VB Code:
Private Sub SomeSub()
On Error GoTo ErrHandler
If Drive1.Drive = "e:" Then
'do whatever that might cause an error
End If
ErrHandler: Exit Sub
End Sub
Has someone helped you? Then you can Rate their helpful post. 
-
Jun 17th, 2005, 07:12 PM
#3
Re: Drive List Help
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
this is where you error is most likely being generated, when it update a directory listbox
pete
-
Jun 18th, 2005, 04:08 AM
#4
Thread Starter
Lively Member
Re: Drive List Help
i want it so that if there is a cd in drive d: or a Zip Disk in Drive E: it will show it in the Directory list and if there isn't a cd/Zip disk in there it will say in a msgbox, the drive is empty
i have already got the C: drive to show in the directory list, and i have put a zip disk in and have looked a the files in the directory list from that,
can you help
-
Jun 18th, 2005, 05:03 AM
#5
Re: Drive List Help
Private Sub Drive1_Change()
On Error Resume Next
Dir1.Path = Drive1.Drive
End Sub
this will remove the error you get, if there is an error it just skips it,
in most cases not good practice, but probaly ok for this,
so if no cd in drive, although drive box will show "D" directory list will still be from previous
pete
-
Jun 18th, 2005, 05:29 AM
#6
Thread Starter
Lively Member
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
|