|
-
Jul 14th, 2000, 02:15 AM
#1
Thread Starter
Frenzied Member
Hi.
I know I'm just full of questions today.
Does anybody know if there is a way to check whether or not there is a floppy disk in the drive without asking for a specific filename??
-
Jul 14th, 2000, 02:18 AM
#2
Fanatic Member
I'm sure there is...but you can simply ask for A:\ and have some kind of external error handling when windows replys that there is not disk.
Or just goto http://www.vb-world.net/tips/tip99.html it has info on checking if a cd is in...so just chnage some values and that should do it..
gl,
D!m
-
Jul 14th, 2000, 02:28 AM
#3
Code:
On Error Resume Next 'keep going on error
For i = 1 To 2 '2 times is enough
Open "a:\" For Random As #1 'open the a: drive
Close #1 'close the a: drive
Next 'do it again
Work with that code...it may get you somewhere in life.
-
Jul 14th, 2000, 02:59 AM
#4
Thread Starter
Frenzied Member
sorry more help please
Hi.
Thanks both for the help
I wonder if this makes sense:
If there is a floppy disk in A: Then ( Do This)
Else (Do Nothing)
I am trying to figure out how to make this work but I really dont know how to do error handling.
Further patience and suggestions are appreciated.
THanks
-
Jul 14th, 2000, 03:26 AM
#5
Frenzied Member
Code:
Private Sub Command1_Click()
If DiskInDrive() Then
MsgBox "There seems to be a disk in A: drive"
Else
MsgBox "There doesn't seem to be a disk in A: drive"
End If
End Sub
Function DiskInDrive() As Boolean
On Error GoTo ErrHan
Dir "a:\", vbDirectory
DiskInDrive = True
Exit Function
ErrHan:
DiskInDrive = False
End Function
-
Jul 17th, 2000, 04:50 AM
#6
Error handling quick intro to help U
Try this code at the beginning of the procedure, say on a button click:
Sub CmdButton1_Click()
On error goto BuggerIt
Open "a:\" For Random As #1
BuggerIt :
If err.number = 71 then
MsgBox”no disk in drive A”
End If
End Sub
When you get an error message appear on your screen, it normally has a number (as above no disk in your drive when accessing it, occurs an error 71). At the start, on error goto yourname, says to VB "ok, if you get an error, goto the bottom of the page.
At the bottom, you can use the err.number, to see what error has ocurred and deal with that specifically.
With your project this is handy as whether the error is no disk in drive, or cannot find a file on the disk, you are going to have the same message appear, using the err.number (number of the error) you can separate these.
Alex Read
-
Jul 17th, 2000, 05:13 AM
#7
_______
<?>
event code:
Code:
on error goto errHandler:
Dir "A:\"
'bla bla
errHandler:
if error = 52 then
msgbox "please load your disk in drive a:\"
endif
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|