Solved

How to get the Properties of any Object at Runtime?

Posted on 1998-12-22
9
190 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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
 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

707 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