Saving information when program is exited

  • Thread starter Thread starter cmdolcet69
  • Start date Start date
C

cmdolcet69

Does anyone know how i could save a user textbox entery value and then
when the program is shut down it would save that value for the next
time so that it appears when the user start the program back up

Example:

user enters his name:Chuck

I want to be able to save the entery (chuck) so that when he exits the
program (shut down) and then start it back up again the user entry
name in the textbox would be chuck.
 
Does anyone know how i could save a user textbox entery value and then
when the program is shut down it would save that value for the next
time so that it appears when the user start the program back up

Example:

user enters his name:Chuck

I want to be able to save the entery (chuck) so that when he exits the
program (shut down) and then start it back up again the user entry
name in the textbox would be chuck.

Simplest way to do that is with My.Settings.
 
Looks like it is. But with VS2003, this link may prove useful:

http://msdn2.microsoft.com/en-us/library/ms379611(VS.80).aspx

Go to project properties, and then Settings and add a entry called
"name" make it a type of string and make the default value blank.

Then in your app set the default value under the form_load procedure
like this:

txtName.Text = My.Settings.Name

When the program closes, under your form_closed procedure, save it
like this:

My.Settings.Name = txtName.Text
My.Settings.Save()

--

That's all you need.

Good luck :-)

Phill
 
Go to project properties, and then Settings and add a entry called
"name" make it a type of string and make the default value blank.

Then in your app set the default value under the form_load procedure
like this:

txtName.Text = My.Settings.Name

When the program closes, under your form_closed procedure, save it
like this:

My.Settings.Name = txtName.Text
My.Settings.Save()

--

That's all you need.

Good luck :-)

Phill- Hide quoted text -

- Show quoted text -

Phil can you be a little more specific, in the programing environment
vb 2003 i can;t seem to find that option. Please let me know....Thanks
 
cmdolcet69 said:
Phil can you be a little more specific, in the programing environment
vb 2003 i can;t seem to find that option. Please let me know....Thanks

The My.Settings thing isn't in vb 2003. You'll have to write your own
procedure to write the data to a file or into the registry, and similarly to
read the data back in when the app. starts.

Andrew
 
Back
Top