Setting a enumerated value as default value

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cesar Ronchese

    Setting a enumerated value as default value

    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(N avigationDirect ionEnum.Down)> _
    Public Property EnterKeyDirecti on() As NavigationDirec tionEnum
    Get
    Return menmEditMode
    End Get
    Set(ByVal Value As NavigationDirec tionEnum)
    menmEnterKeyDir ection = Value
    End Set
    End Property


    []s
    Cesar


  • Cesar Ronchese

    #2
    Re: Setting a enumerated value as default value

    Found it!

    <DefaultValue(G etType(Navigati onDirectionEnum ), "Top")> _
    Public Property EnterKeyDirecti on() As NavigationDirec tionEnum
    Get
    Return menmEnterKeyDir ection
    End Get
    Set(ByVal Value As NavigationDirec tionEnum)
    menmEnterKeyDir ection = Value
    End Set
    End Property

    []s
    Cesar



    "Cesar Ronchese" <ronchese*smlin fo.com.br> wrote in message
    news:eXZ0mgTxFH A.3000@TK2MSFTN GP12.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(N avigationDirect ionEnum.Down)> _
    Public Property EnterKeyDirecti on() As NavigationDirec tionEnum
    Get
    Return menmEditMode
    End Get
    Set(ByVal Value As NavigationDirec tionEnum)
    menmEnterKeyDir ection = Value
    End Set
    End Property


    []s
    Cesar


    Comment

    Working...