473,769 Members | 4,173 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Registry Reading

In my case, I have registry entries with multiple Key values, like the
following
[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp\ MySection\Data\ A]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp\ MySection\Data\ B]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp\ MySection\Data\ C]

I would like to loop thru MyApp\MySection \Data to get to entries A,B and C,
instead of doing the following for each Key entry:
sEntryA = GetSetting("MyA pp", "MySection\Data \A")
sEntryB = GetSetting("MyA pp", "MySection\Data \B")
sEntryC = GetSetting("MyA pp", "MySection\Data \C")

arr = GetAllSettings( "MyApp", "MySection\Data ") --this gives me the string
Values for Data, not the Key value A,B, and C

Is there a way to loop thru to get to each Key Entry ?

Thanks.

Sep 5 '06 #1
7 2182
Sept. 5, 2006

I don't usually handle the registry, but did you try something similar to
this:

imports microsoft.win32

'code section
Registry.Curren tUser.OpenSubKe y("...your path to the Data node",
False).GetSubKe yNames()

The "false" parameter is whether you are going to want to write to this
registry key. Intellisense states that GetSubKeyNames returns a String()
collection of sub-keys. You could then cycle through these, and I would
think it would contain your A, B, C nodes.

Hopefully this helps!
--
Joseph Bittman
Microsoft Certified Solution Developer
Microsoft Most Valuable Professional -- DPM

Web Site/Blog: http://CactiDevelopers.ResDev.Net/

"fniles" <fn****@pfmail. comwrote in message
news:uy******** ******@TK2MSFTN GP04.phx.gbl...
In my case, I have registry entries with multiple Key values, like the
following
[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp\ MySection\Data\ A]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp\ MySection\Data\ B]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp\ MySection\Data\ C]

I would like to loop thru MyApp\MySection \Data to get to entries A,B and
C,
instead of doing the following for each Key entry:
sEntryA = GetSetting("MyA pp", "MySection\Data \A")
sEntryB = GetSetting("MyA pp", "MySection\Data \B")
sEntryC = GetSetting("MyA pp", "MySection\Data \C")

arr = GetAllSettings( "MyApp", "MySection\Data ") --this gives me the
string
Values for Data, not the Key value A,B, and C

Is there a way to loop thru to get to each Key Entry ?

Thanks.

Sep 6 '06 #2
Fniles,

http://msdn.microsoft.com/library/de...classtopic.asp

There is a registry class, this is not anymore as VB6. You get all allowed
access to the registry.

Be aware that the Open sometimes wil fail. I use than simple Create than I
get the same result in VB2003.

I hope this helps,

Cor
"fniles" <fn****@pfmail. comschreef in bericht
news:uy******** ******@TK2MSFTN GP04.phx.gbl...
In my case, I have registry entries with multiple Key values, like the
following
[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp\ MySection\Data\ A]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp\ MySection\Data\ B]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp\ MySection\Data\ C]

I would like to loop thru MyApp\MySection \Data to get to entries A,B and
C,
instead of doing the following for each Key entry:
sEntryA = GetSetting("MyA pp", "MySection\Data \A")
sEntryB = GetSetting("MyA pp", "MySection\Data \B")
sEntryC = GetSetting("MyA pp", "MySection\Data \C")

arr = GetAllSettings( "MyApp", "MySection\Data ") --this gives me the
string
Values for Data, not the Key value A,B, and C

Is there a way to loop thru to get to each Key Entry ?

Thanks.

Sep 6 '06 #3
fniles wrote:
I would like to loop thru MyApp\MySection \Data to get to entries A,B and C,
instead of doing the following for each Key entry:
sEntryA = GetSetting("MyA pp", "MySection\Data \A")
sEntryB = GetSetting("MyA pp", "MySection\Data \B")
sEntryC = GetSetting("MyA pp", "MySection\Data \C")
I'd do exactly that - loop through them - as in:

Dim sKeys() As String : sKeys _
= Split( "A,B,C", "," )
Dim sValues() As String
ReDim sValues( UBound( sKeys ) )

Dim iIdx As Long
For iIdx = 0 To UBound( sKeys )
sValues( iIdx ) = GetSetting( "MyApp" _
, "MySection\Data \" & sKeys( iIdx ) )
Next

HTH,
Phill W.
Sep 6 '06 #4
When I do the following, it tells me that "CurrentUse r is not a member of
Registry"

Imports System
Imports Microsoft.Win32

Dim names As String() = Registry.Curren tUser.OpenSubKe y("...your path to the
Data node", False).GetSubKe yNames()

The following also gave me the same error
Dim rkCurrentUser As RegistryKey = Registry.Curren tUser

What am I missing ? Thank you.

"Joseph Bittman MVP MCSD" <Ry*********@ms n.comwrote in message
news:OO******** ******@TK2MSFTN GP05.phx.gbl...
Sept. 5, 2006

I don't usually handle the registry, but did you try something similar to
this:

imports microsoft.win32

'code section
Registry.Curren tUser.OpenSubKe y("...your path to the Data node",
False).GetSubKe yNames()

The "false" parameter is whether you are going to want to write to this
registry key. Intellisense states that GetSubKeyNames returns a String()
collection of sub-keys. You could then cycle through these, and I would
think it would contain your A, B, C nodes.

Hopefully this helps!
--
Joseph Bittman
Microsoft Certified Solution Developer
Microsoft Most Valuable Professional -- DPM

Web Site/Blog: http://CactiDevelopers.ResDev.Net/

"fniles" <fn****@pfmail. comwrote in message
news:uy******** ******@TK2MSFTN GP04.phx.gbl...
>In my case, I have registry entries with multiple Key values, like the
following
[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp \MySection\Data \A]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp \MySection\Data \B]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp \MySection\Data \C]

I would like to loop thru MyApp\MySection \Data to get to entries A,B and
C,
instead of doing the following for each Key entry:
sEntryA = GetSetting("MyA pp", "MySection\Data \A")
sEntryB = GetSetting("MyA pp", "MySection\Data \B")
sEntryC = GetSetting("MyA pp", "MySection\Data \C")

arr = GetAllSettings( "MyApp", "MySection\Data ") --this gives me the
string
Values for Data, not the Key value A,B, and C

Is there a way to loop thru to get to each Key Entry ?

Thanks.


Sep 6 '06 #5
When I do the following, it tells me that "CurrentUse r is not a member of
Registry"

Imports System
Imports Microsoft.Win32

Dim rkCurrentUser As RegistryKey = Registry.Curren tUser

What am I missing ? Thank you.

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:eO******** ********@TK2MSF TNGP02.phx.gbl. ..
Fniles,

http://msdn.microsoft.com/library/de...classtopic.asp

There is a registry class, this is not anymore as VB6. You get all allowed
access to the registry.

Be aware that the Open sometimes wil fail. I use than simple Create than I
get the same result in VB2003.

I hope this helps,

Cor
"fniles" <fn****@pfmail. comschreef in bericht
news:uy******** ******@TK2MSFTN GP04.phx.gbl...
>In my case, I have registry entries with multiple Key values, like the
following
[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp \MySection\Data \A]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp \MySection\Data \B]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp \MySection\Data \C]

I would like to loop thru MyApp\MySection \Data to get to entries A,B and
C,
instead of doing the following for each Key entry:
sEntryA = GetSetting("MyA pp", "MySection\Data \A")
sEntryB = GetSetting("MyA pp", "MySection\Data \B")
sEntryC = GetSetting("MyA pp", "MySection\Data \C")

arr = GetAllSettings( "MyApp", "MySection\Data ") --this gives me the
string
Values for Data, not the Key value A,B, and C

Is there a way to loop thru to get to each Key Entry ?

Thanks.


Sep 6 '06 #6
Pls ignore my previous reply. I named my solution and project "Registry",
that's why I got the error I mentioned.
I changed the name of the solution and project to something other than
"Registry" and it now works.
Thanks a lot.

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:eO******** ********@TK2MSF TNGP02.phx.gbl. ..
Fniles,

http://msdn.microsoft.com/library/de...classtopic.asp

There is a registry class, this is not anymore as VB6. You get all allowed
access to the registry.

Be aware that the Open sometimes wil fail. I use than simple Create than I
get the same result in VB2003.

I hope this helps,

Cor
"fniles" <fn****@pfmail. comschreef in bericht
news:uy******** ******@TK2MSFTN GP04.phx.gbl...
>In my case, I have registry entries with multiple Key values, like the
following
[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp \MySection\Data \A]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp \MySection\Data \B]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp \MySection\Data \C]

I would like to loop thru MyApp\MySection \Data to get to entries A,B and
C,
instead of doing the following for each Key entry:
sEntryA = GetSetting("MyA pp", "MySection\Data \A")
sEntryB = GetSetting("MyA pp", "MySection\Data \B")
sEntryC = GetSetting("MyA pp", "MySection\Data \C")

arr = GetAllSettings( "MyApp", "MySection\Data ") --this gives me the
string
Values for Data, not the Key value A,B, and C

Is there a way to loop thru to get to each Key Entry ?

Thanks.


Sep 6 '06 #7
Pls ignore my previous reply. I named my solution and project "Registry",
that's why I got the error I mentioned.
I changed the name of the solution and project to something other than
"Registry" and it now works.
Thanks a lot.

"Joseph Bittman MVP MCSD" <Ry*********@ms n.comwrote in message
news:OO******** ******@TK2MSFTN GP05.phx.gbl...
Sept. 5, 2006

I don't usually handle the registry, but did you try something similar to
this:

imports microsoft.win32

'code section
Registry.Curren tUser.OpenSubKe y("...your path to the Data node",
False).GetSubKe yNames()

The "false" parameter is whether you are going to want to write to this
registry key. Intellisense states that GetSubKeyNames returns a String()
collection of sub-keys. You could then cycle through these, and I would
think it would contain your A, B, C nodes.

Hopefully this helps!
--
Joseph Bittman
Microsoft Certified Solution Developer
Microsoft Most Valuable Professional -- DPM

Web Site/Blog: http://CactiDevelopers.ResDev.Net/

"fniles" <fn****@pfmail. comwrote in message
news:uy******** ******@TK2MSFTN GP04.phx.gbl...
>In my case, I have registry entries with multiple Key values, like the
following
[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp \MySection\Data \A]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp \MySection\Data \B]

[HKEY_CURRENT_US ER\Software\VB and VBA Program
Settings\MyApp \MySection\Data \C]

I would like to loop thru MyApp\MySection \Data to get to entries A,B and
C,
instead of doing the following for each Key entry:
sEntryA = GetSetting("MyA pp", "MySection\Data \A")
sEntryB = GetSetting("MyA pp", "MySection\Data \B")
sEntryC = GetSetting("MyA pp", "MySection\Data \C")

arr = GetAllSettings( "MyApp", "MySection\Data ") --this gives me the
string
Values for Data, not the Key value A,B, and C

Is there a way to loop thru to get to each Key Entry ?

Thanks.


Sep 6 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
12377
by: Bob Kirkwood | last post by:
I believe the intent in .NET is that we store application setup information in an XML file now instead of the Registry or INI files. Is this correct? Are there any tools, sample apps, or guidelines for how to do this?
3
3059
by: Slimo | last post by:
Hello, I'm searching some example of code (VB) for reading remote registry subkeys and keys. Thanks
2
1677
by: Daniel Bass | last post by:
I've found this article on how to get ASP.Net to read/write from the server's registry, but it got heavily critted as being something that you should not do... http://www.wwwcoder.com/main/parentid/263/site/2281/68/default.aspx what's the problem with a server side application reading data from a server
1
1667
by: Peter John | last post by:
I am using the following code to read from and write to the registry. The writing works fine but reading always fails. Can anyone suggest what is going wrong? Imports Microsoft.Win32 Public Class clsRegistry Private Const conRegKey As String = "Software\MyCompany\MyApplication"
8
5492
by: Al Kaufman | last post by:
I have a simple console app that uses: regSubKey = <some registry key> Dim reg As RegistryKey = Registry.ClassesRoot.OpenSubKey(regSubKey) Dim path As String path = CStr(reg.GetValue(""))
2
2810
by: sunil | last post by:
Hi All, I'm need to PHP.. I need a quick information ... Are there any Registry function available in PHP for reading the registry key on the client machine(WindowsXP,Win2K).(I don't need any write operation to the registry). I need to do certain validation for some application on the client machine by reading the registry entry created by some other external application(.exe).
5
5086
by: UJ | last post by:
I have a system that has five programs that all communicate with each other via Message Queues. Works well. One program is a watchdog that will make sure the others are up and going. Currently I have it store info it gets from when the programs check in into a DataSet (XML file). Problem is, that file now has to be used by other programs to find out version information (the file is ALWAYS less that 1K.) The record itself is only five fields...
0
4004
by: tmsprowl | last post by:
Greetings! I was wondering if someone could help me with a problem I'm having. My department is just one of many within my organization. My organization has control over the network domain, but my department has a couple of web servers of our own that are part of my organization's domain. I am trying to read LDAP information on my organization's domain controller from a web application on one of my department's servers. I have been...
3
23768
by: thephatp | last post by:
This is incredibly strange. I used regedit and went to HKEY_LOCAL_MACHINE and create a new subkey under "Software". I added a few more, then went into code to try to read them. I kept getting null returned when I tried to open them, so I decided to try this: Registry.LocalMachine.GetSubKeyNames() The results where dumbfounding--they did NOT match what I see in the Registry under HKEY_LOCAL_MACHINE. The list values returned from the...
5
5083
Sl1ver
by: Sl1ver | last post by:
I have this piece of code public bool Write(string KeyName, object Value) { try { // Setting string subKey1 = "SOFTWARE\\QwixAssets"; RegistryKey rk = Registry.LocalMachine; RegistryKey sk1 = rk.CreateSubKey(subKey1);
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.