codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  getting an object`s property which is decided by content of variable.  hermanningjaldsson at 07:49 on Thursday, April 16, 2009
 

In my code i want to access a property of an object.
thing is though that i do now know beforehand which property this is going to be.

Right now it's like this:

the_value = c_object.c_property;


But the thing is that here c_property is a variable,
i want to get the property who's name is the same as the content of c_property.


How do i do that?



  Re: getting an object`s property which is decided by content of variable.  hermanningjaldsson at 08:24 on Thursday, April 16, 2009
 

I got it, the solution is the following:

c_property_value = eval("c_object." + c_property);




  Re: getting an object`s property which is decided by content of variable.  ariseadi at 11:48 on Friday, April 24, 2009
 

its work ??/

  Re: getting an object`s property which is decided by content of variable.  hermanningjaldsson at 13:17 on Friday, April 24, 2009
 

yes.










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
• C++
• Re: refresh parent after closing pop up window
• Dynamic Insertion
• Date and Time function around the world???
• Significant Factors
• Perl array access
• Re: huffman encoding and decoding in C++...
• Perl One Liner: Replace {(
• Re: html including php, accessing the functions


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2009