VB6: Access object properties by name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. Is there a way to access the property of an object using a string representation of a property name? For example, if I have a class with a property called MyProperty, rather than doing this

myObject.MyPropert

i need to do something like this

dim prop as strin
prop="MyProperty
MsgBox myObject.Properties(prop

Thank

D
 
* =?Utf-8?B?RGF2ZSBUaG9yZW5z?= said:
Hi. Is there a way to access the property of an object using a string
representation of a property name? For example, if I have a class with a
property called MyProperty, rather than doing this:
myObject.MyProperty

i need to do something like this:

dim prop as string
prop="MyProperty"
MsgBox myObject.Properties(prop)

\\\
Result = CallByName(MyObject, "MyProperty", vbGet)
///

BTW: This is a VB.NET group, the VB6 groups can be found at microsoft.public.vb.*.
 
Thanks for the replies Mattias and Herfried, thats just the ticket

And apologies to all for the 'offtopic' post

D
 
Back
Top