Skip to content

Adding Registry Key on PPC2003

Anthony

Asked Aug 24, 2006, 1:46 AM EDT1 answer
Share
LinkedInX
Hi

I wonder if someone her can give me any advice on the following. I am trying to create a form in c# for ppc2003 (in visual studio 2005) that will add/edit a registry key when a button is pressed.

So far i've tried running a .reg file into the registry but with no joy. I am doing something like:

Process.Start("\\My Documets\\new.reg");

Yet this will give me a popup box asking if i want to add the new registry details (yes or no)

I'm guessing i need some arguments to that which will automatically say "yes" for example:

Process.Start("\\My Documets\\new.reg". "1");

But i can't find the correct arg to do this.

My second thought is not to use a registry file at all but actually run the changes to the registry using c# but i can't figure out how iwould go about this so i'd prefer to use the first method.

Any help is much appreciated

Ant

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    its ok, i got it working by removing and then adding the key:

    Registry.CurrentUser.DeleteSubKey("HKEY_CURRENT_USER\\SOFWARE\\key", false);

    RegistryKey key = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Key");

    key.SetValue("Key", "New Key");

    key.Close();

    0