Question I need to get values from registry

gihan92

New member
Joined
Jan 3, 2020
Messages
2
Programming Experience
3-5
I have created vb script for retrieving data from registry.this is my code and result


Code
VB.NET:
Dim x As Integer
Dim con = "\Connection"
Dim sysstn = "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Creative\{computer user id is here}\"
Dim location As String = sysstn
Dim RegKey As Microsoft.Win32.RegistryKey = My.Computer.Registry.LocalMachine.OpenSubKey(location)
Dim subname() = RegKey.GetSubKeyNames

For x = 0 To subname.Length - 1

ListBox1.Items.Add(subname(x))
Next

Result
reg1.png


after I get the largest value from this list

Code
VB.NET:
 Dim currentValue As String = ListBox1.Items.Item(0)

For Each Item As String In ListBox1.Items
If Item > currentValue Then
     currentValue = Item
End If
Next

Label1.Text = currentValue.ToString

Result
reg2.png


and now I want to get value from landscapeImage key inside of that key.pls see the below image

reg3.png


extremely sorry for my bad English. that's why I share images. can anyone help me?
 
There is no landscapeImage key. All the keys are on the left. What you see on the right are values. That's what you need to get: the value with that name, not the key. You already have the name of the key so open that key and then get the value with the desired name.
 
That said, as you're already using My.Computer.Registry, you can just call My.Computer.Registry.GetValue to do the whole lot in one go.
thanks for your reply.i found it.that's my code
VB.NET:
Dim currentSubKey As RegistryKey = RegKey.OpenSubKey(currentValue.ToString)
Dim imageName As String = currentSubKey.GetValue("landscapeImage")
 
Back
Top