Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

How to detect if a register string existed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ad - 08 Mar 2008 08:50 GMT
Hi,
How can I  detect if a register string existed with c#
Jon Skeet [C# MVP] - 08 Mar 2008 13:06 GMT
> How can I  detect if a register string existed with c#

What do you mean by a "register string"? Do you mean you want to search
through the Windows registry, looking for a key or value?

If so, the RegistryKey class is probably the best place to start.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk

ad - 08 Mar 2008 14:04 GMT
Yes, I mean to test if  a registry key exist in the Windows registry.
For example, I want to test if there exist the key
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\IISADMIN"
How can I do that?

"Jon Skeet [C# MVP]" <skeet@pobox.com>
???????:MPG.223c9f9363b3a735a8f@msnews.microsoft.com...
>> How can I  detect if a register string existed with c#
>
> What do you mean by a "register string"? Do you mean you want to search
> through the Windows registry, looking for a key or value?
>
> If so, the RegistryKey class is probably the best place to start.
Jon Skeet [C# MVP] - 08 Mar 2008 14:49 GMT
> Yes, I mean to test if  a registry key exist in the Windows registry.
> For example, I want to test if there exist the key
> "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\IISADMIN"
> How can I do that?

The easiest way is to use RegistryKey.OpenSubKey and see if it returns
null or not. (If it doesn't, remember to call Dispose on the returned
key.)

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.