I just got a simple question:
When you are working with a database, is it then possible to make the program save stuff, so when you close and open the program, it could etc. save a text in a textbox?
Printable View
I just got a simple question:
When you are working with a database, is it then possible to make the program save stuff, so when you close and open the program, it could etc. save a text in a textbox?
You need to call the save-procedure in the Close_event ;)
What code do you have already?
Explain, im new at this point. =)
I dont have any code, but i just wanted to now, how to save the things...
I would suggest that you read the FAQ thread at the top of the Database Development forum and follow the relevant links for ADO.NET explanations and examples.
This is actually quite simple. When the user hits the close application button you want to simple write whatever information you need to your database and then close the application. So in your example saving a text box data what you'd need to do is on the close event write the text box data to your database then close out the application. When you open the application in the "on load" procedure just open a connection to your data base pull the information from the database and then write it to your text box.
I have a question about the question: While it is possible to save the text from a textbox to the database, is that where the data ought to be saved?
Generally, programs that work with databases are written so that the user enters a few things, those few things are saved to the database when the user clicks a button, then the user enters a few more things, and so on. When you talk about saving the text in a textbox when the program closes, it makes me think that you just want to retain the current state of the program at the time that it was closed. This is done more easily using My.Settings than by saving the state to a database, though the database option would work.