Posted 21 March 2022, 10:18 am EST
According to:
https://www.grapecity.com/activereportsnet/docs/latest/online/breaking-changes.html
With this change, scripts with WinForms dependencies must be rewritten in event handlers (for code-based reports), or, in some cases, you may need to load WinForms dependencies manually by using code similar to the following.
WHY would you do that? We have try/catch in thousands of reports at customers sites that display a MessageBox if there is an issue, and now we have to modify ALL of their RPX files? I just don’t understand why you removed the system files being loaded/accessible.
In addition, i can’t get your script to work:
public void ActiveReport_ReportStart()
{
this.rpt.AddAssembly(System.Reflection.Assembly.Load(“System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”));
}
public void ActiveReport_DataInitialize()
{
rpt.Fields.Add("Today"); rpt.Fields["Today"].Value = System.DateTime.Now.ToString("MMMM d, yyyy h:mm tt"); MessageBox.Show("A");
}
When run:
Report creation failed - report script compile error on line 11: The name ‘MessageBox’ does not exist in the current context.