By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,964 Members | 1,810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,964 IT Pros & Developers. It's quick & easy.

VB6: Access object properties by name

P: n/a
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

Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Dave,

CallByName

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 20 '05 #2

P: n/a
* =?Utf-8?B?RGF2ZSBUaG9yZW5z?= <an*******@discussions.microsoft.com> scripsit:
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.*.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3

P: n/a
Thanks for the replies Mattias and Herfried, thats just the ticket

And apologies to all for the 'offtopic' post

D

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.