C Chad Miller Apr 5, 2004 #1 I have a class with 50 properties sp01 .. sp50 is there a way to call a property using a string? ex. o.sp & "01" Chad
I have a class with 50 properties sp01 .. sp50 is there a way to call a property using a string? ex. o.sp & "01" Chad
A Armin Zingler Apr 5, 2004 #2 Chad Miller said: I have a class with 50 properties sp01 .. sp50 is there a way to call a property using a string? ex. o.sp & "01" Click to expand... You can, but be careful, the compiler won't complain if a name is missing: see the CallByName statment and the topic "Reflection": http://msdn.microsoft.com/library/en-us/cpguide/html/cpcondiscoveringtypeinformationatruntime.asp especially sub topic "Dynamically Loading and Using Types" -- Armin How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Chad Miller said: I have a class with 50 properties sp01 .. sp50 is there a way to call a property using a string? ex. o.sp & "01" Click to expand... You can, but be careful, the compiler won't complain if a name is missing: see the CallByName statment and the topic "Reflection": http://msdn.microsoft.com/library/en-us/cpguide/html/cpcondiscoveringtypeinformationatruntime.asp especially sub topic "Dynamically Loading and Using Types" -- Armin How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
C Chad Miller Apr 5, 2004 #3 Thanks, that worked great! It also taught me allot about the reflection class.