Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Registry GetValue

Status
Not open for further replies.

JBaileys

Technical User
Jun 23, 2003
244
US

What is the best method to retrieve a value from the registry?

RegistryKey key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Folder\\etc");
strDBName = key.GetValue("DBName");
key.Close();
 
const string SUBKEYBASE = "Software\\Company\\etc";
const string DBSERVER = "DBServer";


// get some registry keys for the sql server connection

RegistryKey regKey;
regKey = Registry.LocalMachine.OpenSubKey ( SUBKEYBASE, false );
strDBServer = regKey.GetValue ( DBSERVER, "Application\\Key" ).ToString ();
regKey.Close ();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top