vb.net Configuration, settings file location?

Jess31
Jess31 used Ask the Experts™
on
I have a vb.net winforms application. I compiled and published it. Then I copied publish folder to another computer. It runs fine.
But I would like change settings in the configuration file. How can I do this? Where can I find location of the Configuration file. I am referring to settings one can create and put in properties (right click on project), settings tab.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Fernando SotoRetired
Distinguished Expert 2017

Commented:
It should in the same location the application exe fille is located.
from the .net ide you can find it here:
config file
Add reference to System.Configuration
Dim config = System.Configuration.ConfigurationManager.
  OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoamingAndLocal)
MessageBox.Show(config.FilePath)

Open in new window

Change UserLevel as you need. See this article for more details
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Author

Commented:
Ark,
I get msg ConfigurationManager is not a member of System.Configuration and ConfigurationUserLevel is not a member of System.Configuration

Author

Commented:
arana,
This properties shows me where it puts it on my computer, and does not allow me to change it.
ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
How are the settings scoped? Application-scoped settings will be in the config file the others have mentioned; user-scoped settings will be in a config file found under the current user's profile folder (i.e. AppData).

Author

Commented:
I have scoped both ways with same results.
I get msg ConfigurationManager is not a member of System.Configuration and ConfigurationUserLevel is not a member of System.Configuration
Repeat: Add reference to System.Configuration Go to project properties -> references ->add-> .Net tab, and choose System.Configuration

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial