471,093 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,093 software developers and data experts.

How to load an object's property which is an array list?

I have an object which I set up like this:
Public Class Person
....
Protected m_timelists as ArrayList
....
Property timelists() as ArrayList
Get
timelists = m_timelists
End Get
Set (ByVal Value as ArrayList)
m_timelists = Value
End Set
End Property

Is this legal and valid??? If yes, keep going:
Now I want to set it with some objects:

PersonList.addtimeobject(myUserid, time) 'Time object is previously created
and valid

Public Class PersonList
Dim personlist as new ArrayList 'To hold all the person objects
....
Public Function addtimeobject(ByVal userid as string, ByVal time as object)
Dim i as integer = 0
For i = 0 to personlist.count-1
if personlist(i).userid = userid then
personlist(i).timelists.add(time)
end if
Next
End Function

Error returned: Object variable or With block variable not set. This is
occurring on the timelists Arraylist Property Get and Set areas.

Can someone assist???? Thanks!
Nov 20 '05 #1
2 1761
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> schrieb
I have an object which I set up like this:
Public Class Person
...
Protected m_timelists as ArrayList
...
Property timelists() as ArrayList
Get
timelists = m_timelists
End Get
Set (ByVal Value as ArrayList)
m_timelists = Value
End Set
End Property

Is this legal and valid???
Yes, but in the example you never assign anything to the timelists property,
so m_timelists is still Nothing and you get...
Error returned: Object variable or With block variable not set.
This is occurring on the timelists Arraylist Property Get and Set
areas.


.... this error.

Declare
Protected m_timelists as NEW ArrayList
or assign an arraylist to the timelists property.
--
Armin

Nov 20 '05 #2
AHHHHHHHH - many many thanks, wonderful and thanks again!

Derek

"Armin Zingler" <az*******@freenet.de> wrote in message
news:40***********************@news.freenet.de...
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> schrieb
I have an object which I set up like this:
Public Class Person
...
Protected m_timelists as ArrayList
...
Property timelists() as ArrayList
Get
timelists = m_timelists
End Get
Set (ByVal Value as ArrayList)
m_timelists = Value
End Set
End Property

Is this legal and valid???
Yes, but in the example you never assign anything to the timelists

property, so m_timelists is still Nothing and you get...
Error returned: Object variable or With block variable not set.
This is occurring on the timelists Arraylist Property Get and Set
areas.


... this error.

Declare
Protected m_timelists as NEW ArrayList
or assign an arraylist to the timelists property.
--
Armin

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Poewood | last post: by
reply views Thread by a | last post: by
26 posts views Thread by yb | last post: by
9 posts views Thread by Greger | last post: by
4 posts views Thread by =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.