473,385 Members | 1,409 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,385 software developers and data experts.

dynamically getting similar indentifiers while program running

Hallo!
I would like to get some information from the Properties.Settings of an
application which can be done via
.... Properties.Settings.Default.XYZ;

The problem now is that the identifier (XYZ) is not constant. There are
defined some settings looking similar like XYZ34, XYZ56, XYZ87, ... The
indentifier needed is generated dynamicly at runtime.

What must I do to get as result the line
.... Properites.Settings.Default.XYZ34
at one time and
.... Properites.Settings.Default.XYZ87
at an other time in the same codeline???

I hope you can understand my problem.
Thankfully waiting for help!!

Sep 21 '06 #1
3 1146
Hi,

Index into the collection of settings:

string settingName = "XYZ56";
object value = Properties.Settings.Default[settingName];
Using Settings in C# on MSDN:
http://msdn.microsoft.com/library/de...asp?frame=true

--
Dave Sexton

"KarlM" <Ma******@newsgroup.nospamwrote in message news:A0**********************************@microsof t.com...
Hallo!
I would like to get some information from the Properties.Settings of an
application which can be done via
... Properties.Settings.Default.XYZ;

The problem now is that the identifier (XYZ) is not constant. There are
defined some settings looking similar like XYZ34, XYZ56, XYZ87, ... The
indentifier needed is generated dynamicly at runtime.

What must I do to get as result the line
... Properites.Settings.Default.XYZ34
at one time and
... Properites.Settings.Default.XYZ87
at an other time in the same codeline???

I hope you can understand my problem.
Thankfully waiting for help!!

Sep 21 '06 #2
Hi Martin,

I agree with Dave that we can use Default[settingname] to achieve this.
However, the only disadvantage is that the returned object is not strong
typed. You have to do that cast yourself. HTH.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Sep 22 '06 #3
Thank you Dave, thank you Kevin,

it works!

"Dave Sexton" wrote:
Hi,

Index into the collection of settings:

string settingName = "XYZ56";
object value = Properties.Settings.Default[settingName];
Using Settings in C# on MSDN:
http://msdn.microsoft.com/library/de...asp?frame=true

--
Dave Sexton

"KarlM" <Ma******@newsgroup.nospamwrote in message news:A0**********************************@microsof t.com...
Hallo!
I would like to get some information from the Properties.Settings of an
application which can be done via
... Properties.Settings.Default.XYZ;

The problem now is that the identifier (XYZ) is not constant. There are
defined some settings looking similar like XYZ34, XYZ56, XYZ87, ... The
indentifier needed is generated dynamicly at runtime.

What must I do to get as result the line
... Properites.Settings.Default.XYZ34
at one time and
... Properites.Settings.Default.XYZ87
at an other time in the same codeline???

I hope you can understand my problem.
Thankfully waiting for help!!


Sep 22 '06 #4

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

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
16
by: Chris Maloof | last post by:
Hello, Does anyone know how I can read the ASCII text from a console window (from another application) in WinXP? It doesn't sound like a major operation, but although I can find the window via...
15
by: Amit D.Shinde | last post by:
I am adding a new picturebox control at runtime on the form How can i create click event handler for this control Amit Shinde
6
by: Simon Verona | last post by:
I would normally use code such as : Dim Customer as new Customer Dim t as new threading.thread(AddressOf Customer.DisplayCustomer) Customer.CustomerId=MyCustomerId t.start Which would create...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
10
by: Jess | last post by:
Hello, If I create a temporary object using a dynamically created object's pointer, then when the temporary object is destroyed, will the dynamically created object be destroyed too? My guess...
36
by: Martin Larsen | last post by:
Hi, When a PHP program links to a library using include or require (or their _once variations), is the library then linked dynamically or statically? While it might seem irrelevant from a...
9
by: Dahak | last post by:
I'm trying to generate dynamic functions to use as separate callbacks for an AJAX API call. The API doesn't seem to allow for the inclusion of any parameters in the callback, so I can't...
4
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I am trying to rebuild code for a working,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.