Setting a enumerated value as default value

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
 
C

Cesar Ronchese

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top