Private Sub Command1_Click() '储存
Open App.Path & "\1.txt" For Append As #1
Print #1, Replace(Text1, " ", "") & " " & Replace(Text2, " ", "")
Close #1
End Sub
Private Sub Command2_Click() '显示
Dim a As String
Open App.Path & "\1.txt" For Input As #1
Do Until EOF(1)
Line Input #1, a
t = Split(a, " ")
If UBound(t) = 1 Then
If t(0) = Text1 Then
Text2 = t(1)
Exit Do
End If
End If
Loop
Close #1
End Sub
'请参考。
存储有两办法,可以到缓存也可以到文件.
最优越的办法是到文件
在程序运行时,数据是保存在内存中的,程序一退出,内存就被释放,如果要长期保存,就要把它存储到外存中,可以使用文件和数据库。
你要把数据写入数据库或者写到文本文件里,然后在程序被再次打开时,加载
写配置文件或者数据库