nomainwin WindowWidth = 550 WindowHeight = 410 statictext #main.statictext1, "Record to Edit", 30, 86, 112, 20 textbox #main.textbox2, 158, 81, 100, 25 textbox #main.textbox3, 286, 81, 100, 25 textbox #main.textbox4, 414, 81, 100, 25 statictext #main.statictext5, "From (a)", 158, 51, 56, 20 statictext #main.statictext7, "To (b)", 286, 51, 40, 20 statictext #main.statictext8, "Total ( b-a x5)", 414, 51, 96, 20 button #main.button9, "SAVE", [button9Click], UL, 158, 181, 42, 25 open "untitled" for window as #main #main, "trapclose [quit1]" print #main, "font ms_sans_serif 0 16" timer 100, [main.inputLoop] [main.inputLoop] 'wait here for input event OPEN "C:\test.txt" FOR INPUT AS #f while eof(#f)=0 line input #f,l$ from$ = (word$(l$,1,",")):to$ = (word$(l$,2,",")):total$ = (word$(l$,3,",")) wend close #f print #main.textbox2, from$ print #main.textbox3, to$ print #main.textbox4, total$ PRINT #main.textbox2, "!contents? From$" PRINT #main.textbox3, "!contents? To$" PRINT #main.textbox4, "!contents? Total$" wait [button9Click] 'Perform action for the button named 'button9' OPEN "C:\test.txt" FOR OUTPUT AS #f while eof(#f)=0 line input #f,l$ print #f, From$;", ";To$; ", ";Total$ wend close #f wait [quit1] close #main
|
|
' nomainwin WindowWidth = 550 WindowHeight = 410 statictext #main.statictext1, "Record to Edit", 30, 86, 112, 20 textbox #main.textbox2, 158, 81, 100, 25 textbox #main.textbox3, 286, 81, 100, 25 textbox #main.textbox4, 414, 81, 100, 25 statictext #main.statictext5, "From (a)", 158, 51, 56, 20 statictext #main.statictext7, "To (b)", 286, 51, 40, 20 statictext #main.statictext8, "Total ( b-a x5)", 414, 51, 96, 20 button #main.button9, "SAVE", [button9Click], UL, 158, 181, 42, 25 open "untitled" for window as #main #main, "trapclose [quit1]" print #main, "font ms_sans_serif 0 16" '----get from file here, once OPEN "C:\test.txt" FOR INPUT AS #f while eof(#f)=0 line input #f,l$ from$ = (word$(l$,1,",")):to$ = (word$(l$,2,",")):total$ = (word$(l$,3,",")) wend close #f print #main.textbox2, from$ print #main.textbox3, to$ print #main.textbox4, total$ print from$ print to$ print total$ '---------------------- timer 100, [main.inputLoop] [main.inputLoop] 'wait here for input event PRINT #main.textbox2, "!contents? From$" PRINT #main.textbox3, "!contents? To$" 'PRINT #main.textbox4, "!contents? Total$" 'you should calculate Total instead Total = val(To$) - val(From$)*5 Total$=str$( Total) 'so your Save routine work PRINT #main.textbox4, Total$ wait [button9Click] 'Perform action for the button named 'button9' 'OPEN "C:\test.txt" FOR OUTPUT AS #f OPEN "C:\test.txt" FOR append AS #f 'if you need to add to file? 'while eof(#f)=0 'you output to file - no need to check for EOF 'line input #f,l$ print #f, From$;", ";To$; ", ";Total$ 'wend close #f wait [quit1] close #main