Suite à mon précédent poste, j'ai trouvé comment accéder à la liste
automatiquement, mais je ne sais pas comment supprimer un élément de cette
liste, voici:
Sub Form_Activate()
Dim ligne As String, i As Long
For i = 0 To File1.ListCount - 1
If Mid(File1.List(i), 14, 7) <> "fac.txt" Then: File1.Remove i
File1.Refresh ' mal placé, question de place ici pour présenter
next i
End Sub
Le REMOVE n'est pas reconnu, une idée pour supprimer, sauf à transférer dans
une liste normale ???
--
Merci beaucoup, au revoir et à bientôt :o)
------
Site éditeur MES ROMANS édités
http://www.manuscritdepot.com/a.joseph-attila-pusztay.1.htm
Site de MES LOGICIELS
http://irolog.free.fr
mon adresse EMail
http://irolog.free.fr/ecrire/index.htm
------------------------------------------------------------------------------------
Bonsoir, merci, mais y a un quiproquo, je parle d'une liste fileListBox (qui va avec DirListBox et DriveListBox), ça n'accepte pas le remove... Sinon, en effet ça modifie l'index de la liste le remove, faut faire depuis le bas avec un step-1
-- Site éditeur MES ROMANS édités http://www.manuscritdepot.com/a.joseph-attila-pusztay.1.htm Site de MES LOGICIELS http://irolog.free.fr mon adresse EMail http://irolog.free.fr/ecrire/index.htm ------------------------------------------------------------------------------------ "Vincent Guichard" a écrit dans le message de news: 453510e8$0$5084$
Patrice Henrio a écrit :
Pour effacer certains éléments
I=0 While I<List.Count If ElémentASupprimer(List(I)) then List.remove I 'attention tous les index sont diminués de 1 à partir de là, I+1 devient I ... 'donc on ne change pas I else I=I+1 end If Wend
On peut aussi compter "à l'envers", puisque seuls les éléments placés après voient leur index changé.
For I = List.Count To 1 Step -1 If ElementASupprimer(List(I)) then List.Remove I End if Next I
Vincent Guichard
Bonsoir, merci, mais y a un quiproquo, je parle d'une liste fileListBox (qui
va avec DirListBox et DriveListBox), ça n'accepte pas le remove... Sinon, en
effet ça modifie l'index de la liste le remove, faut faire depuis le bas
avec un step-1
--
Site éditeur MES ROMANS édités
http://www.manuscritdepot.com/a.joseph-attila-pusztay.1.htm
Site de MES LOGICIELS
http://irolog.free.fr
mon adresse EMail
http://irolog.free.fr/ecrire/index.htm
------------------------------------------------------------------------------------
"Vincent Guichard" <vg.bleuciel.sa@wanadoo.fr> a écrit dans le message de
news: 453510e8$0$5084$ba4acef3@news.orange.fr...
Patrice Henrio a écrit :
Pour effacer certains éléments
I=0
While I<List.Count
If ElémentASupprimer(List(I)) then
List.remove I
'attention tous les index sont diminués de 1 à partir de là,
I+1 devient I ...
'donc on ne change pas I
else
I=I+1
end If
Wend
On peut aussi compter "à l'envers", puisque seuls les éléments placés
après voient leur index changé.
For I = List.Count To 1 Step -1
If ElementASupprimer(List(I)) then
List.Remove I
End if
Next I
Bonsoir, merci, mais y a un quiproquo, je parle d'une liste fileListBox (qui va avec DirListBox et DriveListBox), ça n'accepte pas le remove... Sinon, en effet ça modifie l'index de la liste le remove, faut faire depuis le bas avec un step-1
-- Site éditeur MES ROMANS édités http://www.manuscritdepot.com/a.joseph-attila-pusztay.1.htm Site de MES LOGICIELS http://irolog.free.fr mon adresse EMail http://irolog.free.fr/ecrire/index.htm ------------------------------------------------------------------------------------ "Vincent Guichard" a écrit dans le message de news: 453510e8$0$5084$
Patrice Henrio a écrit :
Pour effacer certains éléments
I=0 While I<List.Count If ElémentASupprimer(List(I)) then List.remove I 'attention tous les index sont diminués de 1 à partir de là, I+1 devient I ... 'donc on ne change pas I else I=I+1 end If Wend
On peut aussi compter "à l'envers", puisque seuls les éléments placés après voient leur index changé.
For I = List.Count To 1 Step -1 If ElementASupprimer(List(I)) then List.Remove I End if Next I