Setting a collection in a class

G

Guest

I have a class (Task) with a collection property (SubTask) (which is a
collection of another class). I have my Let statement as below, but when I
try to make the call to set the property with a collection, I get an invalid
use of property error upon compiling. Anyone know what I am doing wrong?
Thanks.

'This line doesn't work in a separate method
Set Task.SubTasks = colTasks

'Class Property
Private pSubtask As New Collection

'let statement
Property Let SubTasks(S As Collection)
Set pSubtask = S
End Property
 
R

Robert Bruce

Roedd said:
I have a class (Task) with a collection property (SubTask) (which is a
collection of another class). I have my Let statement as below, but
when I try to make the call to set the property with a collection, I
get an invalid use of property error upon compiling. Anyone know what
I am doing wrong? Thanks.

'This line doesn't work in a separate method
Set Task.SubTasks = colTasks

'Class Property
Private pSubtask As New Collection

'let statement
Property Let SubTasks(S As Collection)
Set pSubtask = S
End Property

Property Let SubTasks

should be

Property Set SubTasks

--
Rob

"We live in a decaying age. Young people no longer respect their
parents. They are rude and impatient. They frequently inhabit taverns
and have no self control". (Inscription, 6,000 year-old Egyptian tomb)
 
G

Guest

J,

Use Set instead of Let

Property Set SubTasks(S As Collection)
Set pSubtask = S
End Property
 

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