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:')
Printable View
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:')
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
[Edited by Megatron on 09-06-2000 at 06:30 PM]Code:On Error GoTo EH
Open "D:\MyFile.txt" For Input As #1
EH:
If Err = 71 Then MsgBox ("Disk not ready")
On Error GoTo EH:
Dir ("d:") 'or Dir (a:)
EH:
If Err.Number = 52 Then MsgBox ("Disk not ready")
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
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
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)
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).
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
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
Wow! Je suis impressione! Du monde du Quebec sur VB-World.
En pire encore - des americains qui parlent francais!:p
Eh ben, on aura tout vu.
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...