Registry Key . . . ? ? ?

Hello . . . :D

I need some help on registry.

I like to add some keys with their values to registry and that it is easy. I already have do that. Now i need to know how to check if the key that i'm trying to add already exists. Is any way to see if the key exists before i try to write on it

Thanks a lot . . . :D




Answer this question

Registry Key . . . ? ? ?

  • Slappie

    You can call CreateSubKey() for a key that already exists without a problem. Use OpenSubKey() to check if it exists. For example:
    Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey("Software\CompanyName\MyApp\Settings")
    If key Is Nothing Then
    Debug.Print("Does not exist")
    End If




  • Dan Yerex

    When someone gives you a correct answer, please remember to mark their answer as being correct!

  • Hu Xinrui

    Thanks a lot . . . :D That's was very good idea . . . Thanks . . . :D

  • Registry Key . . . ? ? ?