Iterating through class properties? 
Author Message
 Iterating through class properties?

I want to pass a class/object to a method.  Once I have
it, I want to programatically iterate through all of the
exposed properties (and potentially methods) on that
object, and perfrom actions based on them.  

I can't seem to find a collection etc. that I can iterate
through.  Does anyone know of a way to list all of the
properties on a class - through code.

Thanks.

Bill Harvey



Tue, 20 Jan 2004 04:57:25 GMT  
 Iterating through class properties?
Bill

I'm taking a bit of a stab in the dark here, but I suspect
you'd have to use the IIUnknown interface declaration with
QueryInterface as a starting point - this is hidden by VB,
but is, as I understand it, the basis for generalised
interface handling which is done for you.  You could probably
get better advice if you try the microsoft.public.vb.winapi
group (or something close to that).

Quote:

> I want to pass a class/object to a method.  Once I have
> it, I want to programatically iterate through all of the
> exposed properties (and potentially methods) on that
> object, and perfrom actions based on them.

> I can't seem to find a collection etc. that I can iterate
> through.  Does anyone know of a way to list all of the
> properties on a class - through code.

> Thanks.

> Bill Harvey



Thu, 22 Jan 2004 21:51:41 GMT  
 Iterating through class properties?
You may be able to use the TlbInf32.DLL to extract the information.  The
following link will get you started, but also search for some of the code
examples available.  You can literally build an Object Browser with this
like that in VB along with numerous other capabilities.

http://support.microsoft.com/support/kb/articles/Q224/3/31.ASP

Might be overkill for what you're wanting, but thought I'd mention it.

HTH

Note: I actually attempted to post this on 8/3 but I guess a blackhole got
ahold of it. <bg>

--
Patrick Logan, MCSD

Opinions expressed are my own and not necessarily those of my employer.



Wed, 28 Jan 2004 01:46:13 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Iterating a form's property values

2. iterating database properties?

3. Iterate Properties on ContactItem

4. How to iterate through ContactItem properties?

5. Iterate through custom properties from VBA?

6. Q: Iterate a controls properties at runtime?

7. Iterating through the properties of an object?

8. Iterate through an object's properties (any object)

9. Iterating through properties of a VB com object at runtime

10. Iterating through the properties of an object

11. Exposing Properties collection in custom classes as many MS Classes do

12. Exposing a Properties collection in custom classes as many MS Classes do

 

 
Powered by phpBB® Forum Software