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
| Option Explicit
Dim nomfichier As String
Dim numfichier As Integer
Private Sub Form_Load()
nomfichier = "C:\PersoFrancis\AAAAA.txt" '********** A modifier ********
End Sub
Private Sub Command1_Click()
numfichier = FreeFile
Open nomfichier For Output As numfichier
'Print #numfichier, txtNom.Text, txtPrenom.Text, txtDateNaissance.Text
Write #numfichier, "Texte dans txtNom", "Texte dans txtPrenom", "Texte dans txtDateNaissance"
Close #numfichier
End Sub
Private Sub Command2_Click()
Dim LineResult As String, Decoupe() As String
numfichier = FreeFile
Open nomfichier For Input As numfichier
Line Input #numfichier, LineResult
Close #numfichier
Decoupe = Split(LineResult, ",")
txtNom.Text = Replace(Decoupe(0), Chr(34), "")
txtPrenom.Text = Replace(Decoupe(1), Chr(34), "")
txtDateNaissance.Text = Replace(Decoupe(2), Chr(34), "")
End Sub |
Partager