Hi Bart,
When you set up a Windows Application project, VS IDE automatically add a
Settings.settings file under the MyProject folder if you're using VB.NET or
the Properties folder if you're using C# in the project directory.
VS IDE has generated a class in the Settings.settings file to access the
application settings. If you double click the Settings.Designer.vb or
Settings.Designer.cs file under the node of Settings.settings in the
Solution Explorer, you will see the class.
You could make use of the class to access the application settings
conveniently. For example, suppose that we have added a setting named
setting1 in the application and the setting is of type string. If you're
using VB.NET, use the following line of code.
Dim val As String = My.Settings.Setting1
If you're using C#, use the line of code as follows.
string val = Properties.Settings.Default.Setting1;
Generally speaking, the app.config file needn't be copied to the output
directory, because when we build the project, a config file named
yourappname.exe.config or yourappname.dll.config depending on the
application type of your project is generated in the output directory.
Finally, to add settings in a project, you have two options to do that.
1. Right-click the project node in the Solution Explorer and choose
Properties. In the Project Designer, switch to Settings tab. Then you could
add settings in the list box on the right panel.
2. Double-click the Settings.settings node under the My Project or
Properties folder in the Solution Explorer. The setting file is opened in
the designer with an UI, where you could add settings.
Hope this helps.
If you have anything unclear, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.