J
Just Me
Public Shared Function GetValue(ByVal keyName As String, ByVal valueName As
String, Optional ByVal badKey As Object = "") As Object
Dim UserKey As RegistryKey =
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\JUNK\ keyName)
If Not UserKey Is Nothing Then
GetValue = CType(UserKey.GetValue(valueName, badKey), badKey.GetType())
lCurrentUserKey.Close()
Else
GetValue = badKeyReturn
End If
End Function
If the value in the registry is a Boolean, say False,
lCurrentUserKey.GetValue returns a string, like "False".
I'd like the routine to return the type stored (Boolean in this example)
so I tried to set the return to agree with badKey
but the compiler doesn't like
badKeyReturn.GetType() , says it's not defined
I've played around enough to know the problem is that CType expects a type
and doesn't believe I've given it one.
Know how to fix it??
Thanks
String, Optional ByVal badKey As Object = "") As Object
Dim UserKey As RegistryKey =
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\JUNK\ keyName)
If Not UserKey Is Nothing Then
GetValue = CType(UserKey.GetValue(valueName, badKey), badKey.GetType())
lCurrentUserKey.Close()
Else
GetValue = badKeyReturn
End If
End Function
If the value in the registry is a Boolean, say False,
lCurrentUserKey.GetValue returns a string, like "False".
I'd like the routine to return the type stored (Boolean in this example)
so I tried to set the return to agree with badKey
but the compiler doesn't like
badKeyReturn.GetType() , says it's not defined
I've played around enough to know the problem is that CType expects a type
and doesn't believe I've given it one.
Know how to fix it??
Thanks