Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How do I check if a registry entry exists in the windows registry.

How do I check if a registry entry exists in the windows registry.

Scheduled Pinned Locked Moved Visual Basic
questioncsharpwindows-adminhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Simon_221175
    wrote on last edited by
    #1

    :confused:I just started learning the vb.net and I would like to know how can I check if a subkey exists in the registry and use a code to create the subkey it if does not exist in the registry. All help will be welcome. Thank you, Simon:confused:

    D 1 Reply Last reply
    0
    • S Simon_221175

      :confused:I just started learning the vb.net and I would like to know how can I check if a subkey exists in the registry and use a code to create the subkey it if does not exist in the registry. All help will be welcome. Thank you, Simon:confused:

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      There is an example of this very topic on the samples for VB.NET:

      Private Sub DoesKeyExist
      Dim regVersion As Microsoft.Win32.RegistryKey
      regVersion = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\TestApp\\1.0", True)
      If regVersion Is Nothing Then
      regVersion = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("SOFTWARE\\Microsoft\\TestApp\\1.0")
      End If
      End Sub

      This will check to see if a key exists, then if not, creates it. Oh yeah! It also needs a reference to the Win32 namespace. RageInTheMachine9532

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups