using strings to access object properties/other members

Tucker_Futtbucker

New member
Joined
Jan 21, 2008
Messages
2
Programming Experience
3-5
hello -

this is my first post here. i plan on being a regular on this forum depending on the level of expertise of everyone else because i will undoubtedly have many questions about vb.net.

question:

i have an object (a textbox, for example, stored in variable tb) and would like to access its members via string. i have been introduced to the following:

tb.GetType.GetMembers.GetValue

however, i haven't been able to successfully return anything. the below example represents the concept of what i am actually trying to accomplish, although the code is not correct:

tb.GetType.GetMembers("ID").GetValue

so how would i go about getting the ID property of a control (or any property of any other object) by using a string?

thanks in advance.
 
Why do you need to use a string in the first place? Many ask this type of question. Most don't actually need to. You may be one of the few who do, but let's make sure there isn't a better way first.
 
Back
Top