cs_chris_p
Messages postés120Date d'inscriptionlundi 25 octobre 2004StatutMembreDernière intervention27 juillet 2010
-
4 avril 2005 à 16:58
jpleroisse
Messages postés1788Date d'inscriptionmardi 7 novembre 2000StatutMembreDernière intervention11 mars 2006
-
4 avril 2005 à 18:12
Lut
Dans un ptit prog, un boutton enregistre la valeur du textbox dans un fichier au format append.
De ce fait, le fichier comporte une ligne de plus à chaque enregistrement.
Comment faire pour lire et afficher toutes les lignes dans un unique textbox multilignes, quel que soit le nombre de lignes écrites dans le fichier ?
jpleroisse
Messages postés1788Date d'inscriptionmardi 7 novembre 2000StatutMembreDernière intervention11 mars 200627 4 avril 2005 à 18:12
Private Sub Command1_Click()
Dim crlf, tout, texte
On Error Resume Next
crlf = Chr(13) + Chr(10)
Open "C:\TonFichier.txt" For Input As #1
Line Input #1, texte
tout = texte
If Len(tout) <> 0 Then
While Not EOF(1)
Line Input #1, texte
tout = tout + crlf + texte
Wend
Text1.Text = tout
End If
Close #1
End Sub
Si tu modifes le fichier, tu l'enregistres en quittant.
Private Sub cmdQuitter_Click()
Open "C:\TonFichier.txt" For Output As #1
Print #1, Text1.Text
Close #1
End
End Sub