在Form的 Form_QueryUnload 下输入保存代码:
RichTextBox1.SaveFile "D:\1.txt"
这样就会自动保存到 D:\1.txt
在Form的 Form_Load输入下面打开代码:
dim strTmp as string
RichTextBox1.Text=""
open "D:\1.txt" for input as #1
While Not EOF(1)
Line Input #1, strTmp
RichTextBox1.Text = RichTextBox1.Text & strTmp & vbCrLf
Wend
close #1
保存
bvc=RichTextBox
Open App.Path & "\1.txt" For Output As #1
Print #1, bvc
Close #1
打开
Open App.Path & "\1.txt" For Input As #1
Do While Not EOF(1)
Input #1, strData
RichTextBox = strData
Loop
Close #1