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

Convert myObject.Parameter to string "myObject.Parameter"

P: n/a
Hi,

Is it possible to pass in an object and parameter into a function and
return it as a string.

i.e.

To make a call to the function i would put the following

Dim str as String = MyTestFunction(myObject.Parameter)

str should equal "myObject.Parameter"

if myObject was of type myObj, then str should return "myObj.Parameter"

Thanks

Nov 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hello, Nemisis!

What type has myObj.Property?

IMO to accomplish what you want you have to pass
to MyTestFunction not only propery value, but the whole type.

NHi,

NIs it possible to pass in an object and parameter into a function and
Nreturn it as a string.

Ni.e.

NTo make a call to the function i would put the following

NDim str as String = MyTestFunction(myObject.Parameter)

Nstr should equal "myObject.Parameter"

Nif myObject was of type myObj, then str should return
N"myObj.Parameter"

NThanks


--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Nov 24 '06 #2

P: n/a

Vadym Stetsyak wrote:
Hello, Nemisis!

What type has myObj.Property?

IMO to accomplish what you want you have to pass
to MyTestFunction not only propery value, but the whole type.
Vad,

Maybe i have not explained to well. If i run the code below, what code
would i need in the function.

Dim A As Company = Company.GetCompany(6) ' 6 is the Id of the
company

Dim str as String = ReturnClassAndPropertyAsString(A.Name)

str should be equal to "Company.Name".

I believe i would have to use reflection for this? but i am not sure
if maybe there is a simpler solution that i do not know about.

Nov 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.