7,785
社区成员




Option Explicit
Dim filename As String
Private Function exist() As Boolean
exist = (Dir(filename) <> "")
End Function
Private Sub Form_Load()
Dim s As String
On Error Resume Next
filename = App.Path & "\data.txt"
If Not exist Then
Open filename For Binary As #1
Close #1
End If
Open filename For Input As #1
Do
Line Input #1, s
Text1.Text = Text1.Text & s & vbCrLf
Loop While Not EOF(1)
Close #1
Text1.SelStart = Len(Text1.Text)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Kill filename
Open filename For Binary As #1
Put #1, , Text1.Text
Close #1
End Sub
Open "c:\data.txt" For Append As #1
Print #1, Text1.Text
Close