populate public property from a function

J

Jon Paal

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
.......................
 
M

Marina Levit [MVP]

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.
 
J

Jon Paal

"myfunction" is in the control.

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

what should I be doing ?
 
M

Marina Levit [MVP]

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.
 

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