I have this code:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Registry.CurrentUser.OpenSubKey(@"HKEY_CURRENT_USER\software\google");
}
}
form1
has only ONE Button.
I want to open HKEY_CURRENT_USER\software\google\
by clicking the button.
But the Button does nothing after clicking, why?
Your code opens an object and returns it. If you assign this object to a variable like this:
var key = Registry.CurrentUser.OpenSubKey(@"HKEY_CURRENT_USER\software\google");
you can for example, change it after that assignment.
If you want to open regedit tool, you should use following code:
Process.Start("regedit.exe")