-
I have a program that copies certain files to a floppy disk, and if someone clicks the "create floppy" button, and there is a floppy disk in it, it writes to the dsik.
but if there is no floppy disk in there then a runtime error comes up and it closes the program, is there something that I can do to make an error message come up saying that there is no floppy, instead of having the program crash?
-
Error trapping!!!!!!
You're looking for error 68 or 76 - I forget which...
-
<?>
ok..do it and get the error number
then in your createfloppy routine do this
'in the click event of the create
On Error Goto NoDisk:
do your stuff
bla bla
NoDisk:
if err.number = "your error number" then
msgbox "Sorry, you need a disk"
exit sub
endif
End Sub
-
or
you could just check the dir and that will generate
err.number 52
like this.
Private Sub Command1_Click()
On Error GoTo NoDisk:
Dir "a:\"
MsgBox "I didn't work."
NoDisk:
If Err.Number = "52" Then
MsgBox "Tell them whatever"
Exit Sub
End If
End Sub
-
Re: <?>
the error number is 71, thanx, it worked
-
Just a note. Since Number is the default property for Err, you can omit it and you can omit the quotes around the numbers as well.
-