ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Declaring a collection as a particular type of object or a particular class (https://www.excelbanter.com/excel-programming/401199-declaring-collection-particular-type-object-particular-class.html)

Ronald Dodge[_2_]

Declaring a collection as a particular type of object or a particular class
 
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



Peter T

Declaring a collection as a particular type of object or a particular class
 
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


"Ronald Dodge" wrote in message
...
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






All times are GMT +1. The time now is 01:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com