470,624 Members | 2,511 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,624 developers. It's quick & easy.

Save calculations

6
Hi! i am i trying to make o vb program and i have a big problem.
I have a combination of forms into i put some keywords and i transfer data from one form into an other (from text to text or from labels to texts). I have a command and when i press it, it makes all the work, all the calculations and completes all the tables i have to the forms. The problem is when i have finished i want to keep this calculations. i don't want to lose them and to make them from the begging. The program take the names of the soldiers of the army and put them to a table of tasks. I want to use this program weekly. Is there any solution? A save command?? Or i way to export the tables as it is designed to a word with a simply command??
I Hope to hear news soon. . .
Many thanks J.K.
Apr 2 '08 #1
10 1323
kadghar
1,295 Expert 1GB
I want to use this program weekly. Is there any solution? A save command?? Or i way to export the tables as it is designed to a word with a simply command??
I Hope to hear news soon. . .
Many thanks J.K.

The easier way to save progress is to save your variables in a text file, then read them when you load it.

If you promess you'll be honest, the text file can have variables as they are, but if not, you'd beter use some cryptography.

HTH
Apr 2 '08 #2
epp319
6
is there a code to load the variables automatically or i have to put them one by one from the beginning??

many thanks for your help
Apr 2 '08 #3
epp319
6
is there a code to load the variables automatically or i have to put them one by one from the beginning??

many thanks for your help
Apr 2 '08 #4
epp319
6
is there a code to load the variables automatically or i have to put them one by one from the beginning??

many thanks for your help
Apr 2 '08 #5
epp319
6
is there a code to load the variables automatically or i have to put them one by one from the beginning??

many thanks for your help
Apr 2 '08 #6
epp319
6
is there a code to load the variables automatically or i have to put them one by one from the beginning??

many thanks for your help
Apr 2 '08 #7
Yes, gon on my FREE VB TOOLS and you will find how to SAve and OPen a *.txt FILES.

BorlandDelphi
Apr 2 '08 #8
kadghar
1,295 Expert 1GB
is there a code to load the variables automatically or i have to put them one by one from the beginning??

many thanks for your help
Well, there's not a magic code, but its quite simple. I'll write a little example where i define a couple of public variables, a Sub to save them and a Sub to load them:

Expand|Select|Wrap|Line Numbers
  1. dim Var1 as string
  2. dim Var2 as string
  3.  
  4. sub SaveVars()
  5. dim Lon1 as integer
  6. var1 = inputbox("write Var1") 'you dont need this, is just for this
  7. var2 = inputbox("write Var2") 'example not to have empty variables.
  8. lon1 = freefile
  9. open "C:\SaveGame.txt" for output as #lon1
  10. print #lon1, var1
  11. print #lon1, var2
  12. close #lon1
  13. end sub
  14.  
  15. sub LoadVars()
  16. dim Lon1 as integer
  17. lon1 = freefile
  18. open "C:\SaveGame.txt" for input as #lon1
  19. input #lon1, var1
  20. input #lon1, var2
  21. close #lon1
  22. msgbox "your first variable is: " & var1
  23. msgbox "your second variable is: " & var2
  24. end sub
you can run the first sub to store a couple of words, then close your application, or turn off your computer, then run only the second sub to see how it works (make sure you turn on your computer again before this step).

HTH
Apr 2 '08 #9
Hah, so many code, so many work. Insert my Free VB Tools - Easy Open and Easy Save *.ocx,add to the form and the work is finished

BorlandDelphi
Apr 2 '08 #10
kadghar
1,295 Expert 1GB
Hah, so many code, so many work. Insert my Free VB Tools - Easy Open and Easy Save *.ocx,add to the form and the work is finished

BorlandDelphi
So many code??
its a simple-one-line method to read/write
i dont know an easier way, but if you do, please share the code. it's always good to learn something new.

Otherwise, please read the site's terms of use
Apr 2 '08 #11

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Andras Gilicz | last post: by
11 posts views Thread by lduperval | last post: by
3 posts views Thread by brian kaufmann | last post: by
3 posts views Thread by John M | last post: by
1 post views Thread by James Scott | last post: by
6 posts views Thread by Sanjay | last post: by
6 posts views Thread by Josetta | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.