Save user entered data

G

Guest

I have a Win app in C#. I want to save the data the user enterere into
textboxes and the selections the user made to comboboxes when the user close
the app. So next time when the user launches the app, he can see the data he
entered before.

How can I do this?

Thanks.
 
M

Michael A. Covington

John said:
I have a Win app in C#. I want to save the data the user enterere into
textboxes and the selections the user made to comboboxes when the user
close
the app. So next time when the user launches the app, he can see the data
he
entered before.

How can I do this?

Write them to a file, and read the file and put the data back in the boxes
(or set SelectedItem to match was was saved) next time.
 
A

AnsweringMachine

An easy way is to take advantage of the auto-generated Settings class
(under Properties in your project folder). Double-click it to define a
few settings of User scope for your controls and you'll be able to
access these settings in code using strongly typed properties on the
Settings class. Make sure to call the Save method on the Settings class
before you app exits to save the settings. Next time you launch the
app, the settings will be automatically loaded.

You can also access the ApplicationSettings property on both TextBox
and ComboBox to edit the same settings as mentioned above. You can
easily tie settings up with specific properties on the controls using
the second approach.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top