Click here to Skip to main content
11,934,425 members (31,119 online)
Click here to Skip to main content
Add your own
alternative version


16 bookmarked

Get the registry keys recursively

, 7 Oct 2005
Rate this:
Please Sign up or sign in to vote.
Get the registry keys recursively
  • <A href="GetRegistryKeys/"></A><A href="GetRegistryKeys/">Download source files - 47 Kb</A> 


If you need to get the registry keys recursively you can use this function. This fills the textbox with the registry key and all inside.

The usual imports:

Imports Microsoft

Imports Microsoft.Win32

Imports Microsoft.Win32.Registry

The code is generated by a call:


This works for the HKEY_LOCAL_MACHINE main key. You can easily change to get the others.

First you open the main key with this:


The R var opens the key and now we can get those subkeynames to an array. And now it is time to read all values inside this key with:

k += GetMyKeys(key)

This function reads those values and returns a string with it.

The secret for this to recursively works is in the GetMyStrings function. Let's see it:

k += GetMyStrings(k1)

End If


Let's go key by key and check if there are another keys inside this one and if there are, just call this function recursively. The new parameter is the new key. And the function just goes and do the work.



This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Adelino Araújo
Portugal Portugal
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
Dave Kreskowiak10-Nov-09 8:30
mvpDave Kreskowiak10-Nov-09 8:30 
GeneralSource code Pin
Vitaly7-Oct-05 23:35
memberVitaly7-Oct-05 23:35 
AnswerRe: Source code Pin
Adelino Araújo12-Oct-05 12:46
memberAdelino Araújo12-Oct-05 12:46 
Hi. Thanks for the information. I have edited the article and didnt updated the zip file. This is a serious bug of the site. An "unmet expectation" is a real bug: "Not meeting the user's expectation is one of the hardest bugs to solve" - John Robbins, DEBUGGING APPLICATIONS for Microsoft .NET and Microsoft Windows.
I did expected that if i'm only changing the text, wouldnt not be necessry to upload again the code files. I was wrong.
GeneralRe: Source code Pin
Chris Maunder16-Oct-05 11:11
adminChris Maunder16-Oct-05 11:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.151126.1 | Last Updated 7 Oct 2005
Article Copyright 2005 by Adelino Araújo
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid