473,231 Members | 1,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Equivalent of My.Settings in c#

GS
How do I use My.Settings equivalent in C#? Below is part of MSDN documentation about accessing settings file. I wrote C# console application using VS 2005 and .NET 2.0 and would like to use new settings file in 2.0 and can not find any documentation about using c#, there is some for VB.NET.



This section contains topics describing the My.Settings object and the tasks it enables you to accomplish.

My.Settings
The properties of the My.Settings object provide access to your application's settings. To add or remove settings, use the Project Designer. For more information, see How to: Add or Remove Application Settings.

The methods of the My.Settings object allow you to save the current user settings or revert the user settings to the last saved values.

Tasks
The following table lists examples showing how to access an application's forms.

To See
Update the value of a user setting
How to: Change User Settings in Visual Basic

Display application and user settings in a property grid
How to: Create Property Grids for User Settings in Visual Basic

Save updated user setting values
How to: Persist User Settings in Visual Basic

Determine the values of user settings
How to: Read Application Settings in Visual Basic


Dec 22 '05 #1
2 20708
GS wrote:
How do I use My.Settings equivalent in C#? Below is part of MSDN
documentation about accessing settings file. I wrote C# console
application using VS 2005 and .NET 2.0 and would like to use new
settings file in 2.0 and can not find any documentation about using c#,
there is some for VB.NET.


See http://msdn2.microsoft.com/en-us/library/25zf0ze8.aspx for info on
how to add/remove application settings. Once you have added the
settings file you can use the designer to add settings to the app. The
Settings class by default gets created in the Properties namespace under
your application. In code you can create an instance of the Settings
class and then access the settings within it as well as call its
methods. Ex:

Properties.Settings s = new Properties.Settings();
Console.WriteLine(s.UserSetting1);
s.UserSetting1 = "New Value";
s.Save();
--
Tom Porterfield
Dec 22 '05 #2
GS
Perfect. Thanks. That's what I was looking for.
What an improvement over .NET 1.1!
"Tom Porterfield" <tp******@mvps.org> wrote in message
news:uS**************@TK2MSFTNGP10.phx.gbl...
GS wrote:
How do I use My.Settings equivalent in C#? Below is part of MSDN
documentation about accessing settings file. I wrote C# console
application using VS 2005 and .NET 2.0 and would like to use new settings
file in 2.0 and can not find any documentation about using c#, there is
some for VB.NET.


See http://msdn2.microsoft.com/en-us/library/25zf0ze8.aspx for info on how
to add/remove application settings. Once you have added the settings file
you can use the designer to add settings to the app. The Settings class
by default gets created in the Properties namespace under your
application. In code you can create an instance of the Settings class and
then access the settings within it as well as call its methods. Ex:

Properties.Settings s = new Properties.Settings();
Console.WriteLine(s.UserSetting1);
s.UserSetting1 = "New Value";
s.Save();
--
Tom Porterfield

Dec 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Breck Carter | last post by:
Does DB2 UDB 8.x have any feature equivalent to the LOGIN_PROCEDURE option in iAnywhere Solutions SQL Anywhere? (see description below) I want to execute a SET SCHEMA statement whenever a new...
6
by: guy | last post by:
I've come across a general XML file that can be used for reading application specific parameters to store from one running to another (for example last screen position) but can't remember where I...
10
by: Anthony | last post by:
Hi, I've written a small C# application which has toolbars which can be hidden and repositioned. How should I record the current state of the toolbars when the program shuts down so that it can...
10
by: Bishoy | last post by:
Hi, In VB.NET there is a keyword called "My" which has a lot of properties collected at it. Is there any equivalent to this "My" in C#? Thank you.
5
by: Andy | last post by:
I need to write a VB.NET WinForms app. For this purpose I need to keep some settings of the application, like many other Windows applications do. The most obvious solution is to store settings in...
27
by: pamela fluente | last post by:
Hello, for the following code, VS suggests that construct (width= height= ) is out of date and a newer one is recommended: <table><tr><td width="92" height="38" valign="middle">AnyThing</td></...
11
by: Spam Catcher | last post by:
Does the .NET framework provide any equivalent of an applet? I've under Winforms Hosted in IE - but Security is a major headache. Is there a way to bypass these security headaches? Can I sign...
2
pod
by: pod | last post by:
Hello Could someone tell me what is the equivalent of My.Settings when using C#? I wanted to make use of Settings.cs, I have this connections string "myconn" setup in that file and I have not...
3
by: prads | last post by:
Hello, I want to write the following matlab code lines in C++. Somebody pls help me... and one more basic question.....what is C++ equivalent of matlab fid...is it rawsignal in:...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.