Solved

How to get the Properties of any Object at Runtime?

Posted on 1998-12-22
9
185 Views
Last Modified: 2010-05-03
I would like to know how to get a list of exposed public properties of a given object at runtime and probably have a list of them in any form, as a collection or as an array...any thing.
0
Comment
Question by:teluguvadu
9 Comments
 

Author Comment

by:teluguvadu
ID: 1452063
This is urgent
0
 
LVL 1

Expert Comment

by:khaledc
ID: 1452064
Well you can not have an array of all the properties of an object. All what you can do is save the properties of a certain object one by one to User Defined Type variable or declare a variable as the object.
eg:
Dim MyObject as Form 'MyObject will be a Form Type variable
then you can assign this variable to your form
MyObject=form1   'THis will save all the needed property of form1 in MyObject
I hope that answer your quesiton
0
 
LVL 2

Expert Comment

by:PedroG
ID: 1452065
that way you will not know the properties of an unknown automatation object, and in order to do that you must go deep into COM
0
 

Expert Comment

by:stingray
ID: 1452066
Have what you need.  Just found it in the last two days.  Send me your e-mail address and I will send the info to you.  (Have to find out where I saved it in the mean time).

stingray@canada.com
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:teluguvadu
ID: 1452067
Yes, What Khaledc has proposed does'nt help. I guess PedroG has some suggestions and it looks likes stingray too is thinking in the same lines.
0
 
LVL 3

Expert Comment

by:vmano
ID: 1452068
stingray,
can you please post your code so that all (other) experts can take a look at it???

thanks
vmano
0
 

Author Comment

by:teluguvadu
ID: 1452069
The code stingray suggested does'nt help me. I am sorry if it has dampened the urgency.

Thanks
Teluguvadu
0
 
LVL 2

Expert Comment

by:PedroG
ID: 1452070
Teluguvado, you must serch to find how to query the object for its interface, i know it has something to do with the implementation of the IUknown interface.

I'm sory i can't help you right now cos i'm with no free time, i will check this in a few days if still now answer i will search to try and find one
0
 
LVL 1

Accepted Solution

by:
wdavidsmith earned 120 total points
ID: 1452071
If the properties are "public" they should be accessible...

Sub ListProperties(objWhatever As Object)

   Dim prpTemp As Property
   
   ' Loop through the object's properties collection
   For Each prpTemp In objWhatever.Properties
      Debug.Print "Property Name: " & prpTemp.Name
      Debug.Print "Property Value: " & prpTemp.Value
      Debug.Print ""
   Next prpTemp

End Sub

This is the case with database objects (DAO) and should be true for any object that has a properties collection.

I hope this helps...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now