mack
New Member
Posts: 6
|
Saving
Sept 17, 2019 12:29:47 GMT -5
Post by mack on Sept 17, 2019 12:29:47 GMT -5
Hi
This is the bare bones of a little project. My question is, if I enter a value in the textbox how can I get it to save in the box so that it is there next time i switch my computer on?
Thank you for your help.
Regards
Robert
nomainwin
UpperLeftX = 250
UpperLeftY = 100
WindowWidth = 400
WindowHeight = 450
button #1.stock, "Stock", [Stock],UL,30,30,95,65
button #1.exit, "Exit",[quit],LR,30,30,55,35
open "Splash Screen" for window as #1
print #1, "trapclose [quit]"
wait
[Stock]
UpperLeftX = 350
UpperLeftY = 150
WindowWidth = 250
WindowHeight = 300
statictext #2.1, "Product", 20, 20, 50, 20
textbox #2.1, 90, 20, 40,20
open "Stock" for window as #2
print #2, "trapclose [quit]"
wait
[quit]
confirm "Quit?"; quit$
if quit$ = "No" then wait
close #1
close #2
end
|
|
|
Saving
Sept 17, 2019 13:30:31 GMT -5
Post by tsh73 on Sept 17, 2019 13:30:31 GMT -5
Use sequential files. Save file on quit, reload file of start. (also use code tags, button with "C" in a square above forum text editor, to post your code)
nomainwin UpperLeftX = 250 UpperLeftY = 100 WindowWidth = 400 WindowHeight = 450
'make sure file exists open "savedData.txt" for append as #3 close #3 'read from file open "savedData.txt" for input as #3 if not(eof(#3)) then line input #3,value1$ end if close #3
button #1.stock, "Stock", [Stock],UL,30,30,95,65 button #1.exit, "Exit",[quit],LR,30,30,55,35 open "Splash Screen" for window as #1 print #1, "trapclose [quit]" wait
[Stock] UpperLeftX = 350 UpperLeftY = 150 WindowWidth = 250 WindowHeight = 300 statictext #2.1, "Product", 20, 20, 50, 20 textbox #2.1, 90, 20, 40,20 open "Stock" for window as #2 print #2, "trapclose [quit]" 're-populate textbox print #2.1, value1$ wait
[quit] 'get texbox content #2.1 "!contents? value1$" 'save textbox content open "savedData.txt" for output as #3 print #3,value1$ close #3 '------------------------- confirm "Quit?"; quit$ if quit$ = "no" then wait 'small "no" close #1 close #2 end
|
|
mack
New Member
Posts: 6
|
Saving
Sept 17, 2019 14:04:46 GMT -5
Post by mack on Sept 17, 2019 14:04:46 GMT -5
Thanks for your help!
|
|