Home Unanswered Active Tags New Question

Reflection

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
Asked by Anonymous 3 years ago.
Replies
I solved my problem:

PropertyInfo prop = schedulerType.GetProperty("HourFontSize");
prop.setValue(DayPilotScheduler1,"12", null);
Comment posted by Anonymous 3 years ago.
Thanks for posting the solution!
Comment posted by Dan Letecky 3 years ago.
New Reply
This reply is
Your name (optional):

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java