在vb中,如何保存三个变量到一个文本文件的三行中,如何再读回来?

来源:百度知道 编辑:UC知道 时间:2024/05/25 06:21:38
谢谢

Private Sub Command1_Click()
a = 1
b = 2
c = 3
Open App.Path & "\111.txt" For Output As #1
Print #1, a
Print #1, b
Print #1, c
Close 1
'以上是存入文件,以下是从文件读出
Open App.Path & "\111.txt" For Input As #1
Line Input #1, a
Line Input #1, b
Line Input #1, c
Close 1

MsgBox a
MsgBox b
MsgBox c
End Sub