Problem accessing registry value

  • Thread starter Thread starter Mike Lusicic
  • Start date Start date
M

Mike Lusicic

Guest
I am trying to access the value "Manufacturer" in the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation

Here is the code I used:

Dim wkValue As String
Dim wkKeyHKLM = "HKEY_LOCAL_MACHINE\"
Dim wkSubKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation"
wkValue = My.Computer.Registry.GetValue(wkKeyHKLM & wkSubKey, "Manufacturer", "Not Found")
MsgBox(wkValue)

"Not Found" is what displays.

Using Registry Editor for this key

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation

I see Value name: Manufacturer and Value data: Dell

Why do I not get this when I try to get the value using the above code.

In trying to research this scenario, I also tried the following:

Try
wkKey = Registry.LocalMachine.OpenSubKey(wkSubKey)
Catch ex As Exception
MsgBox(ex.Message)
End Try
wkValue = wkKey.Name & vbCrLf & " SubKeys: " & wkKey.SubKeyCount.ToString
wkValue += vbCrLf & " Values: " & wkKey.ValueCount.ToString
MsgBox(wkValue)

This results in Subkeys count of 0 and Values count of 0. I guess if neither way can see the values, then why can RegEdit see them? Why does neither technique result in anything from that key?

Continue reading...
 
Back
Top