mack
New Member
Posts: 6
|
Post by mack on Feb 5, 2021 9:24:46 GMT -5
Hi
I hope everyone is well.
I am really struggling to understand how to save a file and retrieve it after say switching off the computer and have it save the information. I have created a very simple program to attempt this but I'm failing. All I want is to multiply two numbers and have the figures showing when I go back into the program. Can you help?
Regards
Robert
open "c:\users\user\AppData\Roaming\Liberty Basic Pro v4.5.1\TestData" for append as #1
nomainwin button #win.run, "Run", [Run], LR, 25, 15, 40, 30 'button #win.save, "Save", [Save], LL, 25, 15, 40, 30
statictext #win.1, "Value", 10, 10, 75, 25 statictext #win.2, "Value", 10, 50, 75, 25 statictext #win.3, "Total", 10, 90, 75, 25 textbox #win.1, 100, 10, 50, 25 textbox #win.2, 100, 50, 50, 25 textbox #win.total 100, 90, 50, 25
open "Test" for window as #win [Run]
print #win.1, "!contents? number1" print #win.2, "!contents? number2"
total = number1 * number2 print #win.total, total print #win, "trapclose [quit]" wait
[quit] confirm "Close?"; quit$ if quit$ = "No" then wait close #win close #1 end
|
|
|
Post by honkytonk on Feb 5, 2021 10:08:14 GMT -5
The data must be saved in a file:
open "test.txt" for output as #f for x to number of datas print #f, data 'or data$ next x close #f
And call the file when the program is launched:
'....... gosub [openfile] '....... '...... [openfile] open "test.txt" for input as #g while eof(#g)=0 line input #g, data$ ': data = val(data$) wend close #g return
|
|
mack
New Member
Posts: 6
|
Post by mack on Feb 5, 2021 10:16:15 GMT -5
Hi
Thanks for that. I will have a good look at it.
Robert
|
|