Converting VB6 Property statements to .NET

I am attempting to convert a class module written in VB6 to .NET. The main problem is that there are several Property Let procedures that have no analog in .NET. Here is an example:

Property Let Root(lProp As RegRoot)
' Don't accept an invalid Root value.
Select Case lProp
Case HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, _
HKEY_LOCAL_MACHINE
' All is well.
Case Else
lRoot = HKEY_CURRENT_USER
End Select
If lProp <> lRoot Then
lRoot = lProp
If Len(strKeyName) Then
GetKeyHandle lRoot, strKeyName
End If
End If
lRoot = lProp
End Property

How can this be rewritten to work in .NET?

Thanks

[700 byte] By [SteveJensen] at [2007-12-22]
# 1

You need to use the Microsoft.Win32.Registry and related Microsoft.Win32.RegistreyKey classes. The following example should get you started:

Imports Microsoft.Win32

Public Property Root() As RegistryKey
Get
End Get
Set (Value As RegistryKey)
Select Case Value
Case Is Registry.ClassesRoot
....
Case Is Registry.CurrentUser
...
End Set
End Property

Hope this helps,

MSFTAbelValadez at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 2

I can see it will be much easier to user the registry class in .NET than trying to update VB6 code. Thanks.

Steve

SteveJensen at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...