K
Kaypee
below is what I have as part of registry class
Public Function DoesKeyExist() As Boolean
Dim oReg As RegistryKey
Dim bExist As Boolean = False
Try
oReg = m_MSRegRoot.OpenSubKey(m_sKeyPath, False)
If Not oReg Is Nothing Then
bExist = True
End If
Catch ex As Exception
'
Finally
If Not oReg Is Nothing Then
oReg.Close()
oReg = Nothing
End If
End Try
Return bExist
End Function
2005 IDE warns 'Variable oReg is used before it has been assigned a value.
A null reference exception could result at runtime'
My question is - how am I supposed to do this?
Public Function DoesKeyExist() As Boolean
Dim oReg As RegistryKey
Dim bExist As Boolean = False
Try
oReg = m_MSRegRoot.OpenSubKey(m_sKeyPath, False)
If Not oReg Is Nothing Then
bExist = True
End If
Catch ex As Exception
'
Finally
If Not oReg Is Nothing Then
oReg.Close()
oReg = Nothing
End If
End Try
Return bExist
End Function
2005 IDE warns 'Variable oReg is used before it has been assigned a value.
A null reference exception could result at runtime'
My question is - how am I supposed to do this?