Dirlistbox.Path

cs_defluc Messages postés 23 Date d'inscription mardi 24 septembre 2002 Statut Membre Dernière intervention 22 février 2008 - 6 mars 2004 à 12:04
cs_defluc Messages postés 23 Date d'inscription mardi 24 septembre 2002 Statut Membre Dernière intervention 22 février 2008 - 18 juin 2004 à 15:27
Je voudrais renseigner dans une TextBox le chemin complet d'un Item cliqué dans une Dirlistbox.
Comme la sélection ne se fait que par un double clic, Dirlistbox.Path donne la sélection active et non celle du simple clic.
Quelqu'un pourrait-il me proposer une solution ?

defluc

5 réponses

cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
6 mars 2004 à 12:16
Je ne vois pas trop en quoi la sélection ne se fait qu'en double clic :

Private Sub Dir1_Click()

Text1.Text = Dir1.List(Dir1.ListIndex)

End Sub

DarK Sidious

[Responsable API/VB du site www.ProgOtoP.com]
Téléchargez ProgOtoP API Viewer
0
cs_defluc Messages postés 23 Date d'inscription mardi 24 septembre 2002 Statut Membre Dernière intervention 22 février 2008
6 mars 2004 à 12:32
Sous Visual Basic.Net, je reçois le message suivant : 'List' n'est pas un membre de 'Microsoft.VisualBasic.Compatibility.VB6.DirListBox'.

defluc
0
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
6 mars 2004 à 13:10
Ah ! tu es sous VB.NET, ce que je te disais était valable pour VB6. Je ne connais pas VB.NET, et ne peux donc pas t'aider, dsl

DarK Sidious

[Responsable API/VB du site www.ProgOtoP.com]
Téléchargez ProgOtoP API Viewer
0
cs_titititi Messages postés 11 Date d'inscription mercredi 16 avril 2003 Statut Membre Dernière intervention 21 juillet 2004
25 mai 2004 à 12:18
J'ai le même souci que toi :(
Si quelqu'un connait la réponse
merci !
Titi
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_defluc Messages postés 23 Date d'inscription mardi 24 septembre 2002 Statut Membre Dernière intervention 22 février 2008
18 juin 2004 à 15:27
Voilà ma solution.

Private Sub DirListBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DirListBox.Click
DirSel()
End Sub

A la sélection d'un dossier dans la DirListBox, l'évènement On Click appelle la procédure DirSel ci-après qui affiche le chemin complet (Drive, Dosssier, sous-dossier,... dans une TextBox, ici, "PethTextBox.

Private Sub DirSel()
Dim j, SubDirLevel As Short
Dim FileName, TmpStr As String
Dim PathSubPath() As String
Dim NbrSubDir As Integer
PathSubPath = Split(DirListBox.Path & "", "")
SubDirLevel = UBound(PathSubPath)
If PathSubPath(0) & "" = DirListBox.SelectedItem Then
PathTextBox.Text = DirListBox.SelectedItem
Exit Sub
End If
If DirListBox.SelectedIndex = 1 Then
PathTextBox.Text = PathSubPath(0) & "" & DirListBox.SelectedItem & ""
Exit Sub
End If
PathTextBox.Text = ""
For j = 0 To SubDirLevel
TmpStr = PathSubPath(j)
If TmpStr <> "" Then PathTextBox.Text = PathTextBox.Text & TmpStr & "" If SubDirLevel 1 Or TmpStr DirListBox.SelectedItem Then
Exit For
End If
Next
If SubDirLevel < j Then PathTextBox.Text = PathTextBox.Text & DirListBox.SelectedItem & ""
End Sub

:)
defluc
0
Rejoignez-nous