Exception running report using report file and business object data - FastReport.Utils.CompilerExcep

I keep on getting the following exception in C# WinForm project with a very simple form and a button to display a report I have already designed.

An unhandled exception of type 'FastReport.Utils.CompilerException' occurred in FastReport.dll. Additional information: (AutoID): Error CS0103: The name 'CalibrationsView' does not exist in the current context. (SystemID): Error CS0103: The name 'CalibrationsView' does not exist in the current context. (DDate): Error CS0103: The name 'CalibrationsView' does not exist in the current context. (Volume): Error CS0103: The name 'CalibrationsView' does not exist in the current context. (Actual): Error CS0103: The name 'CalibrationsView' does not exist in the current context. (Delta): Error CS0103: The name 'CalibrationsView' does not exist in the current context. (ErrorMargin): Error CS0103: The name 'CalibrationsView' does not exist in the current context. (Multiplier): Error CS0103: The name 'CalibrationsView' does not exist in the current context. (Duration): Error CS0103: The name 'CalibrationsView' does not exist in the current context occurred.

My code behind the button is as follows:

    private void button1_Click(object sender, EventArgs e)
    {
      List<CalibrationModel> data = new List<CalibrationModel>();

      for (int i=0; i<5; i++)
      {
        CalibrationModel c = new CalibrationModel();
        c.AutoID = i;
        c.SystemID = "ID" + i.ToString();
        c.DDate = DateTime.Now.ToLocalTime().ToString();
        c.Volume = i;
        c.Actual = i;
        c.Delta = i;
        c.ErrorMargin = i;
        c.Duration = i;
        c.Speed = i;
        c.Notes = "Test " + i;

        data.Add(c);
      }

      using (Report CReport = new Report())
      {
        CReport.Load("CReport.frx");
        CReport.RegisterData(data, "CalibrationsView", FastReport.Data.BOConverterFlags.AllowFields, 1);
        DataBand d = (DataBand)CReport.FindObject("Data1");
        d.DataSource = CReport.GetDataSource("CalibrationsView");
        CReport.Show();
      }
    }

The report exists, not sure what I am missing as the exception is encountered on the CReport.Show() line???

Thanks,

Sam.

Leave a Comment