Preview control event

edited 6:59AM in FastReport .NET
Hi


How can I intercept a preview control event?

For example i want open a my form when i click into a text box in a report, like CristalReport Viewer 2008

Thanks sorry for my English

Comments

  • edited 6:59AM
    Hello,

    This can be done in the report script. See "Interactive Reports|Handle Preview Clicks" report.
  • edited 6:59AM
    Hi

    In the report script event i can't reference my application objects instance

    Thanks
  • edited 6:59AM
    You can. To do this:

    - go "Report|Options..." menu, select "Script" tab and add a reference to your application's executable module (for example, "Demo.exe")
    - now you will able to use in a script any public class defined in your app.

    For example, your class:
    namespace Demo
    {
      public partial class Form1 : Form
      {
        public static void TestMessage()
        {
          MessageBox.Show("Hello from the main application!");
        }
        ...
      }
    }
    

    and how it can be used from a script:
    Demo.Form1.TestMessage();
    

    If you need to use some object instance, you may define a public static property in your class and assign an instance to it, before you run a report.
  • edited 6:59AM
    Sorry,
    but i can't it.

    I add a reference to myapplication's executable module GestContab.exe.
    When i try execute the preview the messare error are:
    BC2017: 'Impossible find GestContab.exe'
    BC2000: unexpected error while compiler initializing: Can not find specified file

    Thanks
  • edited 6:59AM
    Of course, both FastReport dll and your application must be in the same folder.
  • edited 6:59AM
    Thanks, now report is exactly as it should be!

Leave a Comment