By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,632 Members | 1,499 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,632 IT Pros & Developers. It's quick & easy.

Keeping text in text box

Sten
P: 3
Hi!

When I do some changes in text box and after some time I reload program I would like that my program keeps these changes.

Example:
1) I have number 10 written in text box as default
2) I change number 10 to number 15 and do some calculations
3) I exit the program
4) I start program again and mine text box is already filled with number 10, what I don't want. Is it possible that text box keeps changed value and that it is filled with changed value after closing program and starting it again (in this case "number 15")?

Thanks all for suggestions!
Mar 21 '07 #1
Share this Question
Share on Google+
4 Replies


vijaydiwakar
100+
P: 579
Hi!

When I do some changes in text box and after some time I reload program I would like that my program keeps these changes.

Example:
1) I have number 10 written in text box as default
2) I change number 10 to number 15 and do some calculations
3) I exit the program
4) I start program again and mine text box is already filled with number 10, what I don't want. Is it possible that text box keeps changed value and that it is filled with changed value after closing program and starting it again (in this case "number 15")?

Thanks all for suggestions!
Before closing the programm put all these values in any txt file and at the begning of programm read this file and put the value sin the text box
This task can also be done with the help of Registry
Good Luck
Mar 21 '07 #2

100+
P: 149
Hi!

When I do some changes in text box and after some time I reload program I would like that my program keeps these changes.

Example:
1) I have number 10 written in text box as default
2) I change number 10 to number 15 and do some calculations
3) I exit the program
4) I start program again and mine text box is already filled with number 10, what I don't want. Is it possible that text box keeps changed value and that it is filled with changed value after closing program and starting it again (in this case "number 15")?

Thanks all for suggestions!
If you want your program to keep those changes then you would have to save those changes somewhre (be it database , any txt file etc) so that your program remebrs what was last changed and pick it from their and display it.

thanks
ansuman sahu
Mar 21 '07 #3

P: 62
You can also put these values in Public variables. Store text boxes values in variables and when again load form show values from public variables. But when you exit your exe file all the values will be initiallize.
Mar 21 '07 #4

devonknows
100+
P: 137
You can also put these values in Public variables. Store text boxes values in variables and when again load form show values from public variables. But when you exit your exe file all the values will be initiallize.
Im not to sure if you want to use registry or a text file or a database or any of the above, as all are good answers, below is a link to a module for basic registry operations, like deleting a key etc etc. all data will be stored under

HKEY_CURRENT_USER\Software

http://mishu.eu.org/paste/view.php?id=3196

If you look at the module, you have a few functions to use, deletekey, createnewkey, setkeyvalue etc, also there is a function near the bottom called CreateRegKey, put that in your startup screen or you main form under form load, and put all your values that you are going to use in the Function SetValues, CreateRegKey will call that after it creates your registry key for your program, it will place it under the APPNAME Const near the top.

I know this is a whole module but it will make things easier for people who want to look in the future, Well i hope this helps you in your quest of textbox's :D

Kind Regards as Always
Devon.
Mar 21 '07 #5

Post your reply

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