Hi guys, I am wondering if there is a way to keep the count of the class instances in the class. In C ++ you can declare a Static variable in the header file and access it from different instances of the class. Is it possible to do in vb? Thanks
Printable View
Hi guys, I am wondering if there is a way to keep the count of the class instances in the class. In C ++ you can declare a Static variable in the header file and access it from different instances of the class. Is it possible to do in vb? Thanks
VB has no header files but you can just as easily declare a Shared variable. You'd need to implement Dispose and Finalize methods so that the count could be decremented when an instance was destroyed. You'd increment the count in the constructor.
Thanks Jmc! that worked perfect :)