Solved

How can I store and retrieve a string value in somewhere in register?

Posted on 2006-11-04
5
151 Views
Last Modified: 2010-04-16
Hi, I would like to store a string (a network domain) so my application during startup can use that to bind to and build a TreeView control nodes based on that.  How can I store or retrieve that information and where in the registery can I store this?  Thanks.
0
Comment
Question by:lapucca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 500 total points
ID: 17875269
Hi,

there is an exellent example below:

http:Q_21519280.html "Read and Write to registry in C#:"

which tells you how to write and retreive data from teh registry in c#.  If this is insufficient can you please let me know?
0
 

Author Comment

by:lapucca
ID: 17875280
Thank you.  I think that link could be enough on how to write and retrieve data from registry.
Where is a good place in the registery for me to store this string information for my applicaton?  Thanks.
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17875292
Hi,

I would put in HKEY_LOCAL_MACHINE\SOFTWARE\YOURAPPNAME\

unless there is a particular reason why you do not want it available to people to see.
0
 
LVL 29

Expert Comment

by:Nightman
ID: 17875621
Important consideration for using the registry:

Store user specific information in HKEY_CURRENT_USER\SOFTWARE\YOURAPPNAME - only store system wide settings in HKEY_LOCAL_MACHINE. This is for a couple of reasons:
1. User preferences are USER preferences and not machine preferences.
2. In a 'shared' environment such as Citrix, multiple users actually run the same software on the same server simultaneously. Sharing changed settings in a common store creates havoc.
3. The user may not be an administrator, and therefore may not have permission to write to the HKLM registry hive (usually software is installed as administrator in these scenarios).

Cheers
Night
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 17876090
if u are not very specific about storing it in the registry u could store it in th App config file

u could add a file of the type application confiruation file

and add

<add key="DOMAIN" value="IRIS\DBSERVER" />


u could retrieve it by
System.Configuration.ConfigurationSettings.AppSettings["DOMAIN"]

in code
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
List<PaisEntity> - show some 1 38
LINQ Select all records by MAX data syntax help 1 28
Unlocking a column in excel using C# 17 27
Need help with another query 10 37
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question