Anyone know of a better way of testing to see if a reg key exists? Currently I am just catching the nullreferenceexception and using that ... but I would prefer a "exists" method or the like ...

Anyway, here is what I am doing ...

Imports Microsoft.Win32

Public Class cRegistry

Public Shared Function TestForKey(ByVal Reg_Key_Path As String, _
ByVal Reg_Value As String) As Boolean
Dim s As String
Dim reg_key As RegistryKey
Dim reg_hive As RegistryHive

Try

reg_key = Registry.LocalMachine.OpenSubKey(Reg_Key_Path)
If reg_key.ValueCount = 0 Then
Return False
Else
Return True
End If
Catch nre As NullReferenceException
Return False
Catch e As Exception
Throw New Exception("The following error occured while testing the Registry Key", e)
End Try


End Function

End Class