search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Reflection

Asked by Anonymous
16 years ago.
Hi,

I'm trying to use reflection to change some DayPilotScheduler properties but it doesn't work...

Do you have a code snippet/example that does it ? It would be appreciated and also useful
for other users.

Though, here's my code:

Assembly dayPilotAssembly = Assembly.LoadFrom(Server.MapPath("~") + "\\Bin\\DayPilot.dll");
Type schedulerType = dayPilotAssembly.GetType(DayPilot.Web.Ui.DayPilotScheduler");
object result = null;
object[] arguments = {16};
result = schedulerType.InvokeMember("HourFontSize",BindingFlags.Public | BindingFlags.SetFields, null, DayPilotScheduler1,arguments);

The error tells that I have a MissingFieldException, i.e., that HourFontSize doesn't exists.

Thanks,

Max
Comment posted by Anonymous
16 years ago.
I solved my problem:

PropertyInfo prop = schedulerType.GetProperty("HourFontSize");
prop.setValue(DayPilotScheduler1,"12", null);
Comment posted by Dan Letecky
16 years ago.
Thanks for posting the solution!
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.