reflection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an object and I want to reference one of it's properties at run-time.

Normally if I Knew the property I would write something like:

transrow.GroupDescription = "test data".

but if I had a string variable with the value "GroupDescription" How would
I call this method of the 'transrow' object using this string?

I have tried: transrow.GetType().GetProperty("GroupDescription") = "test
data" but it doesn't seem to work.

Any Ideas? Thanks
 
I found an answer if it helps anyone in the future:

transrow.GetType().GetProperty("GroupDescription").SetValue(transrow, "test
data", Nothing)
 
You might want to check out CallByName Function.

rufus said:
I found an answer if it helps anyone in the future:

transrow.GetType().GetProperty("GroupDescription").SetValue(transrow, "test
data", Nothing)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top