Results 1 to 7 of 7

Thread: floppy disks

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715

    Angry

    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?
    NXSupport - Your one-stop source for computer help

  2. #2
    Addicted Member
    Join Date
    Apr 2000
    Location
    Sheffield, England.
    Posts
    136
    Error trapping!!!!!!

    You're looking for error 68 or 76 - I forget which...
    Visual Basic 6 Enterprise Edition + SP4

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    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
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    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
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715

    Re: <?>

    the error number is 71, thanx, it worked
    NXSupport - Your one-stop source for computer help

  6. #6
    Guest
    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.

    Code:
    If Err = 52 Then






  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    ok, thanx for the tip
    NXSupport - Your one-stop source for computer help

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