cs_Turok
Messages postés78Date d'inscriptionmardi 30 décembre 2003StatutMembreDernière intervention 3 décembre 2011
-
18 mai 2004 à 20:14
cs_Turok
Messages postés78Date d'inscriptionmardi 30 décembre 2003StatutMembreDernière intervention 3 décembre 2011
-
19 mai 2004 à 13:58
Salut,
J'aimerai savoir comment on peut afficher les sous-dossiers dans une liste à partir d'un dossier sélectionné dans une dirlistbox.
Merci d'avance.
ShareVB
Messages postés2676Date d'inscriptionvendredi 28 juin 2002StatutMembreDernière intervention13 janvier 201626 18 mai 2004 à 20:56
salut
tu mets dans Change :
listbox.clear
'on liste le premier dossier
temp$ = dir$(dirlistbox.path) 'je ne sais plus si c'est path qui donne le chemin actuel du dossier sélectionné
if len(temp$) then listbox.additem temp$ else exit sub
do
'et tous les suivants
temp$ = dir$
listbox.additem temp$
loop while len(temp$)
cs_CanisLupus
Messages postés3757Date d'inscriptionmardi 23 septembre 2003StatutMembreDernière intervention13 mars 200621 18 mai 2004 à 21:51
Salut, je ne sais pas ce que tu veux faire mais moi j'utilise ça :
Dim Idx As Integer
Private Sub Command1_Click()
If File1.FileName <> "" Then
If Right$(Dir1.Path, 1) = "" Then
NomFichier = Dir1.Path + File1.FileName
Else
NomFichier = Dir1.Path + "" + File1.FileName
End If
Unload Me
Else
MsgBox "Vous n'avez pas sélectionné de fichier !", vbExclamation, "ERREUR"
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo drv_absent
Dir1.Path = Drive1.List(Drive1.ListIndex)
Idx = Drive1.ListIndex
Exit Sub
drv_absent:
Drive1.ListIndex = Idx
End Sub
Private Sub File1_DblClick()
Command1_Click
End Sub
Private Sub Form_Load()
File1.FileName = "*.txt" 'init du type de fichier
Idx = Drive1.ListIndex
Dir1.Path = "c:\Mes documents" 'init du path de départ
End Sub
Bien sûr, les command1, command2, dir1, file1 et drive1, c des controles de la form (tu changes les noms en fonction de tes propres controles).
Maintenat, les sous dossiers sont affichés ds ta dirlist en dblcliquant.