473,406 Members | 2,954 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,406 software developers and data experts.

search in registry

1
search in registry to find a key by its name and fill the keys and them values in datagridview
please could you help me
Nov 5 '09 #1
2 2286
tlhintoq
3,525 Expert 2GB
What do you have so far for reading the registry?
Do you know how to read / write a single registry entry when you know where it is located?
Nov 5 '09 #2
PRR
750 Expert 512MB
RegistryKey Class does everything for you.
OpenSubKey

MSDN sample code:
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using Microsoft.Win32;
  3. using Microsoft.VisualBasic;
  4.  
  5. public class Example
  6. {
  7.     public static void Main()
  8.     {
  9.         // Delete and recreate the test key.
  10.         Registry.CurrentUser.DeleteSubKey("RegistryOpenSubKeyExample", false);
  11.         RegistryKey rk = Registry.CurrentUser.CreateSubKey("RegistryOpenSubKeyExample");
  12.         rk.Close();
  13.  
  14.         // Obtain an instance of RegistryKey for the CurrentUser registry 
  15.         // root. 
  16.         RegistryKey rkCurrentUser = Registry.CurrentUser;
  17.  
  18.         // Obtain the test key (read-only) and display it.
  19.         RegistryKey rkTest = rkCurrentUser.OpenSubKey("RegistryOpenSubKeyExample");
  20.         Console.WriteLine("Test key: {0}", rkTest);
  21.         rkTest.Close();
  22.         rkCurrentUser.Close();
  23.  
  24.         // Obtain the test key in one step, using the CurrentUser registry 
  25.         // root.
  26.         rkTest = Registry.CurrentUser.OpenSubKey("RegistryOpenSubKeyExample");
  27.         Console.WriteLine("Test key: {0}", rkTest);
  28.         rkTest.Close();
  29.  
  30.         // Open the test key in read/write mode.
  31.         rkTest = Registry.CurrentUser.OpenSubKey("RegistryOpenSubKeyExample", true);
  32.         rkTest.SetValue("TestName", "TestValue");
  33.         Console.WriteLine("Test value for TestName: {0}", rkTest.GetValue("TestName"));
  34.         rkTest.Close();
  35.     } //Main
  36. } //Example
  37.  
Hope this helps.

PS: Do take time to read the Posting Guidelines . We are here to help you with specific problems, not code for you.
Nov 5 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Anurag | last post by:
Hi, I understand that the dbm cfg parameter "DISCOVER" controls whether Search or Known discovery is applicable. Additionally, Search discovery provides a superset of Known discovery. I completely...
0
by: BJ Perry | last post by:
I am now using Win XP, but I had the problem under Win2K and have users under Win2K importing from dbase III plus successfully using Access 2000 and XP. I upgraded to the Jet 4.0 as Microsoft...
4
by: larry | last post by:
Hi, I would like to use window search to search a word in C# CS file which create by visual studio. But I can never get that word in the cs file. for example, I used a name space:...
2
by: Eranga | last post by:
Is there any way that we can serach for a registry key value with a known data. For example if I want to find a registry value with the known data"InternetSearch" how can I do it on C#? for any...
2
by: clintonG | last post by:
I only ask this here because it so happens that Windows Search requires filters to enable it to be used to find text in file types such as .aspx, ..cs and so on and is supposed to support doing so...
2
by: Bob | last post by:
I've seen an article for how to add search paths to a VS.Net XML config file so you don't need to register DLL's in the GAC to have them work in plugins. But the article was for VS.Net 2002, not...
5
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. I'm looking for a way to programmatically scan all installed drives for programs that are installed. Can someone point me to code to look for say,...
2
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Is there a way to start, pause and resume a recurrsive search exactly where you left off, say in the registry programmatically? -- Michael Bragg,...
0
by: weepee | last post by:
Hello, I need search in windows registry, but i do not know how. How to find key with same name in whole registry.. Please, could you help me... thanks.
3
by: =?Utf-8?B?Tm9ybUQ=?= | last post by:
It isn't clear this is the right place to post this, but it IS related to ..NET CONFIG files... Windows Explorer (at least on W2003Server) doesn't seem to know that .config files exist. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.