首先將Text1的MultiLine屬性設(shè)為True
Private Sub Command1_Click()
Dim fso As Object, ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile("d:\1.txt", 1)
Do While ts.AtEndOfStream <> True
Text1.Text = Text1.Text & ts.ReadLine & vbCrLf
Loop
ts.Close
Set ts = Nothing
Set fso = Nothing
End Sub
Private Sub Command2_Click()
Dim fso As Object, ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.CreateTextFile("d:\2.txt", True)
ts.Write Text1.Text
ts.Close
Set ts = Nothing
Set fso = Nothing
End Sub
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請
點(diǎn)擊舉報。