首先将Text1的MultiLine属性设为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
联系客服