5 Replies - 1115 Views - Last Post: 06 May 2012 - 10:31 AM Rate Topic: -----

#1 JavaSuperNoob  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 57
  • Joined: 13-February 12

How to save the exe settings?

Posted 06 May 2012 - 09:53 AM

How do i save the Exe setting? Like i am making a program that will store your semester mark. So once i close it, it won't save when i reopen. How do i make it so that it will save the entire program setting? Thanks for help :)
Is This A Good Question/Topic? 0
  • +

Replies To: How to save the exe settings?

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5432
  • View blog
  • Posts: 11,644
  • Joined: 02-June 10

Re: How to save the exe settings?

Posted 06 May 2012 - 09:57 AM

See FAQ # 10. (Click the SHOW button below)


TOP most asked:
What does this error message mean?
FAQ 2: How do I debug
FAQ 3: How do I make Class1/Form1 talk to Class2/Form2


FAQ (Frequently Asked Questions - Updated Apr 2012
Spoiler



Was This Post Helpful? 0
  • +
  • -

#3 Nerfpl  Icon User is offline

  • D.I.C Head

Reputation: 43
  • View blog
  • Posts: 165
  • Joined: 15-January 12

Re: How to save the exe settings?

Posted 06 May 2012 - 10:15 AM

In Project properties there is a Settings Tab. You can add fields there which then can be save to and read from. MSDN Tutorial

You can than access them like this
Properties.Settings.Default.Something = 0;
Properties.Settings.Default.Save(); //Causes write to file, call it when you closing your app. Otherwise settings are in memory and not in file yet.

int x = Properties.Settings.Default.Something;



In addition objects in designer have 'ApplicationSettings' node where you can bind given property to setting which then will be automatically saved and restored. Also they will react to change so if you bind this way 2 controls to 1 field change in one will be reflected in other.

Other than that you can simply use serialization as tlhIn`toq said.

This post has been edited by Nerfpl: 06 May 2012 - 10:17 AM

Was This Post Helpful? 2
  • +
  • -

#4 JavaSuperNoob  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 57
  • Joined: 13-February 12

Re: How to save the exe settings?

Posted 06 May 2012 - 10:22 AM

Hey, thanks i am not sure what you mean my ApplicationSettings in designer. Where is that? Sorry i am really not familiar with C#. Okay well i guess i now know what you mean my App setting but yet i would wanna store Listbox1 items of the form, how can i do that? What do i choose for Type, Scope and what shall the value be? Confused :/

This post has been edited by tlhIn`toq: 06 May 2012 - 10:39 AM
Reason for edit:: No need to quote the previous post in its entirety: We can all see it.

Was This Post Helpful? 0
  • +
  • -

#5 Nerfpl  Icon User is offline

  • D.I.C Head

Reputation: 43
  • View blog
  • Posts: 165
  • Joined: 15-January 12

Re: How to save the exe settings?

Posted 06 May 2012 - 10:26 AM

1
Attached Image

2
Attached Image

Quote

.. would wanna store Listbox1 items of the form, how can i do that? What do i choose for Type, Scope and what shall the value be?


You shouldn't really save items from listbox, you should save the orginal list of items in your code and then on load simply load them back to listbox.
Listbox should be a viewer/presenter for existing collection.
Settings accept many types, you can use list<string> for example.

Scope-user represents active user. Tied to windows account i believe. So 2 users may have different settings.

Type should be the type you try to save in given setting.

This post has been edited by Nerfpl: 06 May 2012 - 11:50 AM

Was This Post Helpful? 3
  • +
  • -

#6 JavaSuperNoob  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 57
  • Joined: 13-February 12

Re: How to save the exe settings?

Posted 06 May 2012 - 10:31 AM

omg Thank you very much :)

This post has been edited by tlhIn`toq: 06 May 2012 - 10:39 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1