Operate Registry
Public Function GetFromRegistry(ByRef Key As System.String, ByRef SubKey As System.String) As System.String
Dim strResult As System.String = ""
Try
Dim objUserKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine
Dim objSoftwareKey As Microsoft.Win32.RegistryKey = objUserKey.OpenSubKey("Software")
If objSoftwareKey Is Nothing Then
Return ("")
End If
Dim objXigniteKey As Microsoft.Win32.RegistryKey = objSoftwareKey.OpenSubKey("aaaaaa")
If objXigniteKey Is Nothing Then
Return ("")
End If
Dim objSubKey As Microsoft.Win32.RegistryKey = objXigniteKey.OpenSubKey(Key)
If objSubKey Is Nothing Then
Return ("")
End If
strResult = CType(objSubKey.GetValue(SubKey), System.String)
Catch Exception As System.Exception
Console.WriteLine("Unable to access registry for key " & Key & " and subkey " & SubKey)
End Try
Return (strResult)
End Function
Dim strResult As System.String = ""
Try
Dim objUserKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine
Dim objSoftwareKey As Microsoft.Win32.RegistryKey = objUserKey.OpenSubKey("Software")
If objSoftwareKey Is Nothing Then
Return ("")
End If
Dim objXigniteKey As Microsoft.Win32.RegistryKey = objSoftwareKey.OpenSubKey("aaaaaa")
If objXigniteKey Is Nothing Then
Return ("")
End If
Dim objSubKey As Microsoft.Win32.RegistryKey = objXigniteKey.OpenSubKey(Key)
If objSubKey Is Nothing Then
Return ("")
End If
strResult = CType(objSubKey.GetValue(SubKey), System.String)
Catch Exception As System.Exception
Console.WriteLine("Unable to access registry for key " & Key & " and subkey " & SubKey)
End Try
Return (strResult)
End Function