C# - How to save user settings

Coffee Cup Dev · 113K views · 2010 · 5:56

Open on YouTube

Software practice, open source & careersSoftware (other)tutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when someone needs the simplest way to save and reload per-user values such as a chosen path or textbox contents in a C# Windows app.

Recommended by 0 people across 0 different months, 2015 to 2021.

What it is

A short C# tutorial showing how to persist user settings using the built-in .NET Framework settings mechanism instead of hand-rolled INI files. It is a screen-recorded walkthrough from the Coffee Cup Dev channel, credited to Fabio Scopel.

What people said

Cites Alexandre Borela · 2015-07 · Stack Overflow · on “I need my program to save the location that the user has selected the executable from”

[this video] This is by far the easiest way to save user settings. Still, I prefer to serialize objects to XML or JSON (using [LINK] ), I find it easier when dealing with complex settings (lists, dictionaries etc), but I don't think you would need that for now.

Cites user6246171 · 2018-05 · Stack Overflow · on “Save and load listbox items added by user in c# with windows form app”

I want to save listbox items not to a text file, but save them so that when an item is added to the listbox and the application is closed, upon opening the application the item added to the listbox will still be present. Use case: User opens application. User adds item called "Item 1" to listbox using button. User closes application. User opens application again and sees that "Item 1" is still in the listbox, and the added item hasn't been lost by the application closing. I've seen people succeed in doing something like this with textbox data (this video for example: saving user settings [this video] ), but am having trouble getting it to work with listbox data. Here's how I attempted to do it my

Cites marcboo · 2021-08 · Stack Overflow · on “How to get class values in C#”

I think you can pass it as the parameters when you call another form's constructor, if you directly call that form. Like in this case : Communicate between two windows forms in C# [LINK] However, if you need to load it later on, you can either store it as user settings: [this video] . Or even more structural approach is store the data in database like MySQL, MSSQL, or another database that you can put when user click the call to action button.