Try this;
this.GetType().GetProperty("panel1").SetValue(this , 44, null);
Where the property name is "panel1", and the value is 44.
Anyways, I don't think this is good. What you are trying to do aggressively
violates encapsulation. In100% of cases there are better ways to do things
like this using OOP paradigms.
For example, you can have that property virtual/abstract on the base class,
so that the inherters implement it, and you can directly modify it without
the reflection overhead.
"TS" <ma*********@311.com> wrote in message
news:##**************@TK2MSFTNGP11.phx.gbl...
I am trying to get set a property of a control on the inherited class from
base class. I imagine i have to use reflection, so could someone give me
the code to do it?
something like this?
this.GetType().GetMember("panel1").SetValue(xx).Le ft = 44;