By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,519 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

Setting a enumerated value as default value

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
news:eX**************@TK2MSFTNGP12.phx.gbl...
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
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.