Files
docs-desktop/dotnet-desktop-guide/framework/winforms/advanced/how-to-read-settings-at-run-time-with-csharp.md
T
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

1.6 KiB

title, description, ms.date, helpviewer_keywords, ms.assetid
title description ms.date helpviewer_keywords ms.assetid
How To: Read Settings at Run Time With C# Learn how to read both Application-scoped and User-scoped settings at run time with C# via the Properties object. 03/30/2017
application settings [Windows Forms], reading
application settings [Windows Forms], run time
application settings [Windows Forms], C#
dbe8bf09-5e1c-49da-9192-154033d7240b

How To: Read Settings at Run Time With C#

You can read both Application-scoped and User-scoped settings at run time via the Properties object. The Properties object exposes all of the default settings for the project via the Properties.Settings.Default member in the default namespace of the project they are defined in.

To Read Settings at Run Time with C#

Access the appropriate setting via the Properties.Settings.Default member. The following example shows how to assign a setting named myColor to a BackColor property. It requires you to have previously created a Settings file containing a setting named myColor of type System.Drawing.Color. For information about creating a Settings file, see How To: Create a New Setting at Design Time.

this.BackColor = Properties.Settings.Default.myColor;  

See also