自动保存可以保存在文件里,当下次启动程序时再加载文件里的内容。
如下面代码
Private Sub Form_Load()
If Dir("c:\1.txt") <> "" Then
Text1.Text = ""
Dim istr As String
Open "c:\1.txt" For Input As #1
Do Until EOF(1)
Line Input #1, istr
Text1.SelText = istr & vbCrLf
Loop
Text1.Text = Left(Text1.Text, Len(Text1.Text) - 2)
Close #1
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Open "c:\1.txt" For Output As #1
Print #1, Text1.Text
Close #1
End Sub 作者:
xjp-vb 时间: 2007-9-21 23:47 标题: 回复 4# 的帖子