Comment sauvegarder un ListBox ?

cs_BeCaSiNe Messages postés 80 Date d'inscription dimanche 23 février 2003 Statut Membre Dernière intervention 16 juin 2008 - 27 juin 2003 à 12:52
nhervagault Messages postés 6063 Date d'inscription dimanche 13 avril 2003 Statut Membre Dernière intervention 15 juillet 2011 - 27 juin 2003 à 15:19
Comment sauvegarder un ListBox ?
Dernier question !

1 réponse

nhervagault Messages postés 6063 Date d'inscription dimanche 13 avril 2003 Statut Membre Dernière intervention 15 juillet 2011 37
27 juin 2003 à 15:19
dans un fichier txt

Private Sub Command1_Click()
Dim fso As New FileSystemObject
Dim ts As TextStream
Dim c As Integer
Set ts = fso.CreateTextFile("c:\sauv.txt")
c = List1.ListCount
For i = 0 To c - 1
ts.WriteLine (List1.List(i))
Next
ts.Close
End Sub

Private Sub Form_Load()
For i = 0 To 20
List1.AddItem "item " & i
Next
End Sub
0
Rejoignez-nous