Results 1 to 3 of 3

Thread: FileCopy errors

Threaded View

  1. #3
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Code:
    Private Sub Command1_Click()
       On Error Goto Yer_Aving_A_Laugh
    
       FileCopy "C:\AFile.exe", "A:\AFile.exe"
    
    Yer_Aving_A_Laugh :
       If Err.Number = 71 then
          MsgBox "Disk not ready error shown - place a blloming disk in then !!!"
          End Sub
       End If
    End Sub
    Take a look at the search option for the forumns to look up "error handling". The error you get above has the error number as 71. You might run into other problems you might want to test for on this :
    • Is the disk write protected ?
    • Is the disk full

    For the moment, use the above with :
    Code:
    Yer_Aving_A_Laugh :
       Msgbox "Error number is : " & err.number & VBCrlf & _
       "Description : " & err.description 
       'This one will return a messagebox of the error number & description,
       'rather than crash your app, it just exits the SUB (procedure). ;)
    For your testing. Once you're happy that you've covered every angle (and you always miss some )
    You put all the errrors into one big select case statement so your app can't possibly crash....[can it?]
    Code:
    Yer_Aving_A_Laugh :
       Select Case err.number
              'check the number of the error...
       Case 0
              'Do something to encounter it...
       Case 1
              'Do something else...
       Case 2
              'Do something else...
       End Select
    Last edited by alex_read; Apr 12th, 2001 at 02:54 AM.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width