Dim returnValue As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
Dim keyname As String = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
Dim values() As String = returnValue.GetValueNames
Dim value
Dim message As String = ""
For Each value In values
Dim readvalue As String
readvalue = Registry.GetValue(keyname, value, Nothing)
message &= value & " : " & readvalue & vbNewLine
Next
MessageBox.Show(message)
Dim builder As New System.Text.StringBuilder
Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
For Each name As String In key.GetValueNames
Dim value As String = CStr(key.GetValue(name))
builder.AppendFormat("{0} : {1}" & vbNewLine, name, value)
Next
key.Close()
MessageBox.Show(builder.ToString)
Notice that if you have code like "Dim returnValue As RegistryKey" without that Imports the IDE will underline RegistryKey, now if you hover that a exclamation mark appears with Error Correction Options. In this case the options given is adding the namespace or qualifying the type, when you click either the IDE inserts the correct code for you.This imports microsoft.win32