Declaring a collection as a particular type of object or a particular class

R

Ronald Dodge

Is there a way to declare a collection object as a collection of a
particular type of object or as a collection of a particular class? Would
like this for intellisense purposes.

--

Sincerely,

Ronald R. Dodge, Jr.
Master MOUS 2000
 
P

Peter T

You can only declare a collection object '"As Collection" or "As Object.
Thereafter, if fully declared, you will get the intellisense as pertains to
the collection object.

Depending on what you are doing and your needs, maybe you could use an array
of objects instead, eg

Private arrCls() As myClass

ReDim arrCls(1 to n)
Set arrCls(1) = new myClass
arrClss(1). after typing the dot you should get the intellisense

To destroy all objects in the array
Erase arrCls ' not necessary of arrCls is about to go out of scope

FWIW, if you are only adding, not 'removing' objects, I prefer to use an
array like this. Although string key is not available the 'index' of course
is.

Regards,
Peter T
 

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