Solved

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

Posted on 2006-11-04
5
153 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

734 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