Results 1 to 11 of 11

Thread: Tester l'accessibilité à un lecteur

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    15

    Exclamation

    Salut
    Mon problème est simple (je crois). J'ai un DriveListBox,
    un DirListBox et un FileListbox associés entre-eux mais je
    ne sais pas comment vérifier si le lecteur spécifié est
    accessible.(ex: 'A:' ou 'D:')
    I'm not like them
    but I can pretend

  2. #2
    Guest
    Mon français est peu mauvais, cependant, je ferai mon le meilleur à expliquer. Vous essayez la gestion de l'erreur (pourrait être laid, cependant, du travail) pour voir si le lecteur est prêt ou pas

    Code:
    On Error GoTo EH
    Open "D:\MyFile.txt" For Input As #1
    
    EH:
    If Err = 71 Then MsgBox ("Disk not ready")
    [Edited by Megatron on 09-06-2000 at 06:30 PM]

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

    <?>

    On Error GoTo EH:
    Dir ("d:") 'or Dir (a
    EH:
    If Err.Number = 52 Then MsgBox ("Disk not ready")
    "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
    Guest
    Well, now that Megatron has kind of translated a language. I could kind of figure out what he meant, but I didn't want to say anything.

    This will check to see if there is a disk or CD in the drive.

    Code:
    Function DiskInDrive() As Boolean
    On Error GoTo ErrHan
      Dir "D:\", vbDirectory
      
      DiskInDrive = True
    Exit Function
    
    ErrHan:
      DiskInDrive = False
    
    End Function
    
    Private Sub Command1_Click()
    If DiskInDrive() Then
      'do something if there is a disk/CD in D drive.
    Else
      'don't do anything if there is no disk/CD in D drive.
    End If
    End Sub

  5. #5
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    One would try

    Quelqu'un essaierait (si vraiment il desirait une reponse)
    de formuler sa question en Anglais, car la majorite des
    gens dans ce forum ne parle que l'anglais.

    Pourquoi les repondeurs doivent-ils faire un effort tandis
    que ce serait mieux si cet effort etait mutuel!??

    Merci

  6. #6
    Hyperactive Member dsy5's Avatar
    Join Date
    Jul 2000
    Location
    Lockport, NY
    Posts
    362
    Wow, I am impressed! When you attain guru status, you can understand French!
    Touche' Megatron!

    (I better get posting, if I ever want to learn what you guys are talking about)
    Donald Sy - VB (ab)user

  7. #7
    Guest
    dsy5: I knew all of those French courses I took would help me some day!

    Lafor: As I understand, he wants to see if a drive is ready (if there's a disk in it).

  8. #8
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    ok

    Quelqu'un essaierait (si vraiment il desirait une reponse)
    de formuler sa question en Anglais, car la majorite des
    gens dans ce forum ne parle que l'anglais.

    Pourquoi les repondeurs doivent-ils faire un effort tandis
    que ce serait mieux si cet effort etait mutuel!??

    Merci

    Sorry Guys, this is the translation (responding to the
    original person who submitted the message)

    One would try (if indeed he wished to get an answer) to formulate his/her question in English since the majority
    of people in this forum speak English only

    Why should the "responders" make an effort while it would
    be much better if this effort was mutual!??

    Thank you

  9. #9
    Hyperactive Member mastermind94's Avatar
    Join Date
    Jun 2000
    Location
    Montréal, Canada
    Posts
    441

    Lightbulb Simple!

    Tu peux faire comme les autres: mettre une protection contre les erreurs:


    Code:
    On error goto ErrHandler
    dir1.path = drive1.drive
    exit sub
    
    
    Errhandler:
    msgbox err.description, vbcritical, str$(err.number)
    drive1.drive = dir1.path 'Retour au lecteur precedent

  10. #10
    Lively Member
    Join Date
    Aug 2000
    Location
    quebec
    Posts
    81

    Cool

    Wow! Je suis impressione! Du monde du Quebec sur VB-World.

    En pire encore - des americains qui parlent francais!

    Eh ben, on aura tout vu.
    C/C++,Delphi,VB6,Java,PB (blech!),ASP,JSP,SQL...bla bla bla and bla
    I love deadlines. I like the whooshing sound they make as they fly by.
    —Douglas Adams

  11. #11

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    15

    Thumbs up Thank you/Merci

    Well thank you Matthew Gates for your code (and your help)
    It works.
    That's exactly what i needed.

    I'm sorry I had to ask this question in french. I was in a
    hurry and not much time for thinking about tanslation

    But I think I owe you (a least) a reply in english now that
    I have some time to translate my sentences...
    I'm not like them
    but I can pretend

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