These two snippets of code demonstrate how to read a file, as well as how to save a file.
For both of these, the code is shown as it would appear in the click event of a button. However, you can trigger this with anything, such as a timer or a condition changing state.
In the first snippet, I am demonstrating how to save the content of a text box to a text file. You can something similar to save the contents of an array or string variable.
Private Sub Command1_Click()
Filename = InputBox$("Enter A Filename To Save The text")
Open Filename for Output As #1
Print #1, Text1.text
Close #1
End Sub
For the second code snippet, I am showing how to load the content of a text file in to a text box. Similar to the output method above, the target for the text file data could also be a string variable. With slightly different code, you could also load the file into an array.
Private Sub Command2_Click()
Filename = InputBox$("Enter The Filename To Open")
Open Filename for Input As #1
Text1.text = Input(LOF(1), 1)
Close #1
End Sub