Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How I can save the settings I want even after I close the program?

Let's say: If I have a Checkbox and I run the program. If I checked it I want to remain that way even when I reopen again the program. I hope you understand what I want.

I'm a newbie, so take me slow. Thank you.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.3k views
Welcome To Ask or Share your Answers For Others

1 Answer

I recommend using Application Settings Property Binding.

There are many options as mrunion mentioned in his good answer, but I think the most simple way in Windows Forms Application is using Application Settings Property Binding. To do so using designer:

  1. Select your CheckBox in design surface
  2. In properties window, at top, expand (ApplicationSettings), open dropdown for Checked property and select (New...) at bottom of dropdown.
  3. Add your desired property with default value.
  4. Save settings in somewhere like Form_Closing event:

    • C#: Properties.Settings.Default.Save();
    • VB: My.Settings.Save()

(ApplicationSettings) in property window:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...