Setting a enumerated value as default value

  • Thread starter Thread starter Cesar Ronchese
  • Start date Start date
C

Cesar Ronchese

Hi all.

I need to set a default value to my UserControl, but I'm getting a error
when trying reset the value via PropertyGrid on the host IDE: "Object type
cannot be converted to target type".

The value I'm wanting to set came from a enum value. See the code sample:


<DefaultValue(NavigationDirectionEnum.Down)> _
Public Property EnterKeyDirection() As NavigationDirectionEnum
Get
Return menmEditMode
End Get
Set(ByVal Value As NavigationDirectionEnum)
menmEnterKeyDirection = Value
End Set
End Property


[]s
Cesar
 
Found it!

<DefaultValue(GetType(NavigationDirectionEnum), "Top")> _
Public Property EnterKeyDirection() As NavigationDirectionEnum
Get
Return menmEnterKeyDirection
End Get
Set(ByVal Value As NavigationDirectionEnum)
menmEnterKeyDirection = Value
End Set
End Property

[]s
Cesar



"Cesar Ronchese" <ronchese*smlinfo.com.br> wrote in message
Hi all.

I need to set a default value to my UserControl, but I'm getting a error
when trying reset the value via PropertyGrid on the host IDE: "Object type
cannot be converted to target type".

The value I'm wanting to set came from a enum value. See the code sample:


<DefaultValue(NavigationDirectionEnum.Down)> _
Public Property EnterKeyDirection() As NavigationDirectionEnum
Get
Return menmEditMode
End Get
Set(ByVal Value As NavigationDirectionEnum)
menmEnterKeyDirection = Value
End Set
End Property


[]s
Cesar
 
Back
Top