2

I am not able to write "Properties.Settings.Default". It is not coming in the dropdown list. Is there any namespace that we can add?

CharithJ
  • 46,289
  • 20
  • 116
  • 131
B.Vyas
  • 43
  • 2
  • 8

5 Answers5

1

An additional hint on top of the above answers:

Go to solution explorer -> Properties folder -> Settings.settings -> Settings.Designer.cs file

and see which namespace is being used there. Ensure that you are using this namespace in your code file as others have suggested

bkdev
  • 432
  • 4
  • 9
0

Add your project namespace to the Properties namespace. The default namespace defined in the project settings.

For instance if your project default namespace is MyApp.

MyApp.Properties.Settings.Default
CharithJ
  • 46,289
  • 20
  • 116
  • 131
  • "Properties" is not suggested in dropdownlist.. Is there any particular namespace for it?? – B.Vyas Feb 15 '16 at 05:31
  • Look at your project settings and find the default namespace for your project. For instance if it is "MyApp" try MyApp.Properties.Settings.Default – CharithJ Feb 15 '16 at 05:32
0

Make sure you are on the same namespace and try to access the properties like this :

namespace.Properties.Settings.Default

or if you are on different namespace don't forget to use

using namespace
0

Once you setup your environment in the settings under properties of the app. You want to reference it to the project like this:

using App.Properties.Settings

Then in the code you write you can use as example:

userName.Settings.Default

In this case userName is set within the settings.

ivansystems
  • 117
  • 12
0
  1. Set your Setting in your project go to Project => property => go to setting

  2. Set your element (string,int, ecc...)

  3. Save from program all values

Properties.Settings.Default.User = txtUser.Text; Properties.Settings.Default.Password = txtPass.Text; Properties.Settings.Default.Save();

if you use Windows 10, this is the directory of setting Values: C:\Users\AppData\Local<ProjectName.exe_Url_somedata>\1.0.0.0<filename.config>