1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Option Explicit
Dim oFSO As New FileSystemObject, F As Object
Private Sub Command1_Click()
Set F = oFSO.OpenTextFile(App.Path & "\PourCombo.txt", ForAppending, True)
If Text1.Text <> "" Then
F.WriteLine Text1.Text
F.Close
Combo1.AddItem Text1.Text
End If
Text1.Text = ""
Combo1.ListIndex = Combo1.ListCount - 1
End Sub
Private Sub Form_Load()
Dim Ret$
If oFSO.FileExists(App.Path & "\PourCombo.txt") Then
Set F = oFSO.OpenTextFile(App.Path & "\PourCombo.txt", ForReading, False)
While Not F.AtEndOfStream
Ret = F.ReadLine
Combo1.AddItem Ret
Wend
Else : GoTo NoFile
End If
Combo1.ListIndex = Combo1.ListCount - 1 ' Dernier "enregistrement"
NoFile:
End Sub |
Partager