Saturday, March 24, 2012

populate public property from a function

I have a public property in my server control and I want to populate it with values generated by the control.

When I assign the value of the property to a function in the control, which creates the values, I get a compilation error that says
the function doesn't have all the other property values to work with.

So, how do I populate the arraylist as a public property, so I can use it in my web page ?

========== code in use ==========
I create the property wth the webpage by:

............
Dim arrTempList As New ArrayList()
oThis.myArrayList = arrTempList
............

I have the the property defined in the control as:

................
Public arrChartList As Arraylist
Public Property myArrayList As ArrayList
Get
Return arrChartList
End Get
Set
arrChartList = myfunction() '<--builds values for arraylist
End Set
End Property
..................Where is 'myfunction' declared? This looks like a scoping issue.

I am also confused why in the Set for a property, you would completely
ignore the argument and just call a function. Why bother having a Set on the
property to begin with? People are going to be setting the property to
something - but that something will be complete ignored? Very confusing.

"Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message
news:evc1ARHSGHA.5908@.TK2MSFTNGP10.phx.gbl...
>I have a public property in my server control and I want to populate it
>with values generated by the control.
> When I assign the value of the property to a function in the control,
> which creates the values, I get a compilation error that says the function
> doesn't have all the other property values to work with.
> So, how do I populate the arraylist as a public property, so I can use it
> in my web page ?
>
> ========== code in use ==========
> I create the property wth the webpage by:
> ............
> Dim arrTempList As New ArrayList()
> oThis.myArrayList = arrTempList
> ...........
>
> I have the the property defined in the control as:
> ...............
> Public arrChartList As Arraylist
> Public Property myArrayList As ArrayList
> Get
> Return arrChartList
> End Get
> Set
> arrChartList = myfunction() '<--builds values for arraylist
> End Set
> End Property
> .................
"myfunction" is in the control.

Yes, I am totally confused on this and really need help.

what should I be doing ?

"Marina Levit [MVP]" <someone@.nospam.com> wrote in message news:%236og2UHSGHA.4440@.TK2MSFTNGP11.phx.gbl...
> Where is 'myfunction' declared? This looks like a scoping issue.
> I am also confused why in the Set for a property, you would completely ignore the argument and just call a function. Why bother
> having a Set on the property to begin with? People are going to be setting the property to something - but that something will be
> complete ignored? Very confusing.
> "Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message news:evc1ARHSGHA.5908@.TK2MSFTNGP10.phx.gbl...
>>I have a public property in my server control and I want to populate it with values generated by the control.
>>
>> When I assign the value of the property to a function in the control, which creates the values, I get a compilation error that
>> says the function doesn't have all the other property values to work with.
>>
>> So, how do I populate the arraylist as a public property, so I can use it in my web page ?
>>
>>
>> ========== code in use ==========
>> I create the property wth the webpage by:
>>
>> ............
>> Dim arrTempList As New ArrayList()
>> oThis.myArrayList = arrTempList
>> ...........
>>
>>
>> I have the the property defined in the control as:
>>
>> ...............
>> Public arrChartList As Arraylist
>> Public Property myArrayList As ArrayList
>> Get
>> Return arrChartList
>> End Get
>> Set
>> arrChartList = myfunction() '<--builds values for arraylist
>> End Set
>> End Property
>> .................
>>
>>
>>
That depends on what you are trying to do in the first place. You either
want the user to assign a value to the property or you don't and want to
assign the variable a value returned by a function instead.

"Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message
news:%23jldn$HSGHA.224@.TK2MSFTNGP10.phx.gbl...
> "myfunction" is in the control.
> Yes, I am totally confused on this and really need help.
> what should I be doing ?
>
>
> "Marina Levit [MVP]" <someone@.nospam.com> wrote in message
> news:%236og2UHSGHA.4440@.TK2MSFTNGP11.phx.gbl...
>> Where is 'myfunction' declared? This looks like a scoping issue.
>>
>> I am also confused why in the Set for a property, you would completely
>> ignore the argument and just call a function. Why bother having a Set on
>> the property to begin with? People are going to be setting the property
>> to something - but that something will be complete ignored? Very
>> confusing.
>>
>> "Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message
>> news:evc1ARHSGHA.5908@.TK2MSFTNGP10.phx.gbl...
>>>I have a public property in my server control and I want to populate it
>>>with values generated by the control.
>>>
>>> When I assign the value of the property to a function in the control,
>>> which creates the values, I get a compilation error that says the
>>> function doesn't have all the other property values to work with.
>>>
>>> So, how do I populate the arraylist as a public property, so I can use
>>> it in my web page ?
>>>
>>>
>>> ========== code in use ==========
>>> I create the property wth the webpage by:
>>>
>>> ............
>>> Dim arrTempList As New ArrayList()
>>> oThis.myArrayList = arrTempList
>>> ...........
>>>
>>>
>>> I have the the property defined in the control as:
>>>
>>> ...............
>>> Public arrChartList As Arraylist
>>> Public Property myArrayList As ArrayList
>>> Get
>>> Return arrChartList
>>> End Get
>>> Set
>>> arrChartList = myfunction() '<--builds values for
>>> arraylist
>>> End Set
>>> End Property
>>> .................
>>>
>>>
>>>
>>
>>
I want the property to have the value created by the function.

"Marina Levit [MVP]" <someone@.nospam.com> wrote in message news:uW8uI$PSGHA.1780@.TK2MSFTNGP12.phx.gbl...
> That depends on what you are trying to do in the first place. You either want the user to assign a value to the property or you
> don't and want to assign the variable a value returned by a function instead.
> "Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message news:%23jldn$HSGHA.224@.TK2MSFTNGP10.phx.gbl...
>> "myfunction" is in the control.
>>
>> Yes, I am totally confused on this and really need help.
>>
>> what should I be doing ?
>>
>>
>>
>>
>>
>> "Marina Levit [MVP]" <someone@.nospam.com> wrote in message news:%236og2UHSGHA.4440@.TK2MSFTNGP11.phx.gbl...
>>> Where is 'myfunction' declared? This looks like a scoping issue.
>>>
>>> I am also confused why in the Set for a property, you would completely ignore the argument and just call a function. Why bother
>>> having a Set on the property to begin with? People are going to be setting the property to something - but that something will
>>> be complete ignored? Very confusing.
>>>
>>> "Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message news:evc1ARHSGHA.5908@.TK2MSFTNGP10.phx.gbl...
>>>>I have a public property in my server control and I want to populate it with values generated by the control.
>>>>
>>>> When I assign the value of the property to a function in the control, which creates the values, I get a compilation error that
>>>> says the function doesn't have all the other property values to work with.
>>>>
>>>> So, how do I populate the arraylist as a public property, so I can use it in my web page ?
>>>>
>>>>
>>>> ========== code in use ==========
>>>> I create the property wth the webpage by:
>>>>
>>>> ............
>>>> Dim arrTempList As New ArrayList()
>>>> oThis.myArrayList = arrTempList
>>>> ...........
>>>>
>>>>
>>>> I have the the property defined in the control as:
>>>>
>>>> ...............
>>>> Public arrChartList As Arraylist
>>>> Public Property myArrayList As ArrayList
>>>> Get
>>>> Return arrChartList
>>>> End Get
>>>> Set
>>>> arrChartList = myfunction() '<--builds values for arraylist
>>>> End Set
>>>> End Property
>>>> .................
>>>>
>>>>
>>>>
>>>
>>>
>>
>>

0 comments:

Post a Comment