|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Registry Readingfollowing [HKEY_CURRENT_USER\Software\VB and VBA Program Settings\MyApp\MySection\Data\A] [HKEY_CURRENT_USER\Software\VB and VBA Program Settings\MyApp\MySection\Data\B] [HKEY_CURRENT_USER\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("MyApp", "MySection\Data\A") sEntryB = GetSetting("MyApp", "MySection\Data\B") sEntryC = GetSetting("MyApp", "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. Sept. 5, 2006
I don't usually handle the registry, but did you try something similar to this: imports microsoft.win32 'code section Registry.CurrentUser.OpenSubKey("...your path to the Data node", False).GetSubKeyNames() 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! -- Show quoteHide quoteJoseph Bittman Microsoft Certified Solution Developer Microsoft Most Valuable Professional -- DPM Web Site/Blog: http://CactiDevelopers.ResDev.Net/ "fniles" <fni***@pfmail.com> wrote in message news:uytVG0S0GHA.4044@TK2MSFTNGP04.phx.gbl... > In my case, I have registry entries with multiple Key values, like the > following > [HKEY_CURRENT_USER\Software\VB and VBA Program > Settings\MyApp\MySection\Data\A] > > [HKEY_CURRENT_USER\Software\VB and VBA Program > Settings\MyApp\MySection\Data\B] > > [HKEY_CURRENT_USER\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("MyApp", "MySection\Data\A") > sEntryB = GetSetting("MyApp", "MySection\Data\B") > sEntryC = GetSetting("MyApp", "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. > > > When I do the following, it tells me that "CurrentUser is not a member of
Registry" Imports System Imports Microsoft.Win32 Dim names As String() = Registry.CurrentUser.OpenSubKey("...your path to the Data node", False).GetSubKeyNames() The following also gave me the same error Dim rkCurrentUser As RegistryKey = Registry.CurrentUser What am I missing ? Thank you. Show quoteHide quote "Joseph Bittman MVP MCSD" <RyanBitt***@msn.com> wrote in message news:OOiQeSW0GHA.4580@TK2MSFTNGP05.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.CurrentUser.OpenSubKey("...your path to the Data node", > False).GetSubKeyNames() > > 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" <fni***@pfmail.com> wrote in message > news:uytVG0S0GHA.4044@TK2MSFTNGP04.phx.gbl... >> In my case, I have registry entries with multiple Key values, like the >> following >> [HKEY_CURRENT_USER\Software\VB and VBA Program >> Settings\MyApp\MySection\Data\A] >> >> [HKEY_CURRENT_USER\Software\VB and VBA Program >> Settings\MyApp\MySection\Data\B] >> >> [HKEY_CURRENT_USER\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("MyApp", "MySection\Data\A") >> sEntryB = GetSetting("MyApp", "MySection\Data\B") >> sEntryC = GetSetting("MyApp", "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. >> >> >> > > 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. Show quoteHide quote "Joseph Bittman MVP MCSD" <RyanBitt***@msn.com> wrote in message news:OOiQeSW0GHA.4580@TK2MSFTNGP05.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.CurrentUser.OpenSubKey("...your path to the Data node", > False).GetSubKeyNames() > > 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" <fni***@pfmail.com> wrote in message > news:uytVG0S0GHA.4044@TK2MSFTNGP04.phx.gbl... >> In my case, I have registry entries with multiple Key values, like the >> following >> [HKEY_CURRENT_USER\Software\VB and VBA Program >> Settings\MyApp\MySection\Data\A] >> >> [HKEY_CURRENT_USER\Software\VB and VBA Program >> Settings\MyApp\MySection\Data\B] >> >> [HKEY_CURRENT_USER\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("MyApp", "MySection\Data\A") >> sEntryB = GetSetting("MyApp", "MySection\Data\B") >> sEntryC = GetSetting("MyApp", "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. >> >> >> > > Fniles,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfmicrosoftwin32registryclasstopic.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 Show quoteHide quote "fniles" <fni***@pfmail.com> schreef in bericht news:uytVG0S0GHA.4044@TK2MSFTNGP04.phx.gbl... > In my case, I have registry entries with multiple Key values, like the > following > [HKEY_CURRENT_USER\Software\VB and VBA Program > Settings\MyApp\MySection\Data\A] > > [HKEY_CURRENT_USER\Software\VB and VBA Program > Settings\MyApp\MySection\Data\B] > > [HKEY_CURRENT_USER\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("MyApp", "MySection\Data\A") > sEntryB = GetSetting("MyApp", "MySection\Data\B") > sEntryC = GetSetting("MyApp", "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. > > > When I do the following, it tells me that "CurrentUser is not a member of
Registry" Imports System Imports Microsoft.Win32 Dim rkCurrentUser As RegistryKey = Registry.CurrentUser What am I missing ? Thank you. Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:eOG%2349W0GHA.4368@TK2MSFTNGP02.phx.gbl... > Fniles, > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfmicrosoftwin32registryclasstopic.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" <fni***@pfmail.com> schreef in bericht > news:uytVG0S0GHA.4044@TK2MSFTNGP04.phx.gbl... >> In my case, I have registry entries with multiple Key values, like the >> following >> [HKEY_CURRENT_USER\Software\VB and VBA Program >> Settings\MyApp\MySection\Data\A] >> >> [HKEY_CURRENT_USER\Software\VB and VBA Program >> Settings\MyApp\MySection\Data\B] >> >> [HKEY_CURRENT_USER\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("MyApp", "MySection\Data\A") >> sEntryB = GetSetting("MyApp", "MySection\Data\B") >> sEntryC = GetSetting("MyApp", "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. >> >> >> > > 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. Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:eOG%2349W0GHA.4368@TK2MSFTNGP02.phx.gbl... > Fniles, > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfmicrosoftwin32registryclasstopic.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" <fni***@pfmail.com> schreef in bericht > news:uytVG0S0GHA.4044@TK2MSFTNGP04.phx.gbl... >> In my case, I have registry entries with multiple Key values, like the >> following >> [HKEY_CURRENT_USER\Software\VB and VBA Program >> Settings\MyApp\MySection\Data\A] >> >> [HKEY_CURRENT_USER\Software\VB and VBA Program >> Settings\MyApp\MySection\Data\B] >> >> [HKEY_CURRENT_USER\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("MyApp", "MySection\Data\A") >> sEntryB = GetSetting("MyApp", "MySection\Data\B") >> sEntryC = GetSetting("MyApp", "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. >> >> >> > > fniles wrote:
> I would like to loop thru MyApp\MySection\Data to get to entries A,B and C, I'd do exactly that - loop through them - as in:> instead of doing the following for each Key entry: > sEntryA = GetSetting("MyApp", "MySection\Data\A") > sEntryB = GetSetting("MyApp", "MySection\Data\B") > sEntryC = GetSetting("MyApp", "MySection\Data\C") 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.
Remove certain characters from a string/RichTextBox?
[Regular Expression] extraction when bounds are vbCr and vbLf Better way to process many conditions with If Then User Control constructors taking arguments? datagridview.SelectedRows returns last row first? Book Recommendations Request Break up string, Comma Delimited Is the difference intended? Intellisense XML Comments / Documentation SQL Server |
|||||||||||||||||||||||