Home All Groups Group Topic Archive Search About

Design Time referencing of Properties

Author
20 Jan 2006 4:39 PM
Venkat
Hi

I am writing a webcontrol, that has two properties, both are strings. Based
on the value of the first property, I want set the default values of the
second property. I am trying to set the default values of the second property
using typeconverter that inherits stringconverter and overriding
GetStandardValueCollection. In the method GetStandardValueCollection , How do
I referece prop1 (use the value of prop1)?.

Thanks
Venkat

Author
22 Feb 2006 6:58 PM
JoNaS
RefreshPropertiesAttribute might help you on what you're trying to do. I
don't think there's a need for TypeConverter here.
You can do this:

Dim _t1 As String
    <RefreshPropertiesAttribute(RefreshProperties.All), DefaultValue("")> _
    Public Property T1() As String
        Get
            Return _t1
        End Get
        Set(ByVal Value As String)
            _t1 = Value
        End Set
    End Property

    Dim _t2 As String
    Public Property T2() As String
        Get
            Select Case _t1
                Case "1"
                    _t2 = "A"
                Case "2"
                    _t2 = "B"
                Case "3"
                    _t2 = "C"
            End Select
            Return _t2
        End Get
        Set(ByVal Value As String)
            _t2 = Value
        End Set
    End Property

Hope this helps...
JoNaS
Show quoteHide quote
"Venkat" wrote:

> Hi
>
> I am writing a webcontrol, that has two properties, both are strings. Based
> on the value of the first property, I want set the default values of the
> second property. I am trying to set the default values of the second property
> using typeconverter that inherits stringconverter and overriding
> GetStandardValueCollection. In the method GetStandardValueCollection , How do
> I referece prop1 (use the value of prop1)?.
>
> Thanks
> Venkat

Bookmark and Share