Object bindingSource

Greetings,

I'm just a new developer for Fast Report

I want to ask about if Fast-Report support DataSource Object (BindingSource depend on object) ??

if answer YES

so I have problem that

When I add new form to my solution and add new bindingSource named as bindingSource1 that bound to object (LLBL EntityCollection [url="http://www.llblgen.com)" ] http://www.llblgen.com)[/url]
then design my report depend on bindSource1
finally in button view event write this code

var ec = new EntityCollection<CODEActionEntity>();

BL.ActionManager.FillAction(ec, null);
bindingSource1.DataSource = ec;

report1.Prepare();
report1.Show();

after run, I got this error

(Text1): error CS0103: The name 'bindingSource1' does not exist in the current context
(Text3): error CS0103: The name 'bindingSource1' does not exist in the current context
(Text5): error CS0103: The name 'bindingSource1' does not exist in the current context

any one can advice me !!!

BTW. I use my Data access layer to Fill my collection

Comments

  • edited 5:18AM
    Hello,

    FastReport supports business objects. See the demo: Demos\C#\DataFromBusinessObject
  • edited January 2010
    Could you please explain how can I add Business Object to report dataSource ??

    For example, the sample "DataFromBusinessObject" shows in the DataWindow "Categories" which is defined in the winforms project.

    I need to do the same as I have a "Customers" collection defined in my DAL project that I need to show in the DataWindow EXACTLY as the sample shows "Categories". How to do that in VS/FatsReport designers ???
  • edited 5:18AM
    Hello,

    The easiest way to create a new report with BO is to use run-time designer, just like in this demo.
    1) add a button/menu item in your app ("design a report");
    2) write the following event handler for this button:
          // create report instance
          Report report = new Report();
    
          // register the business object
          report.RegisterData(Your_Business_Object, "name_of_BO");
    
          // design the report
          report.Design();
    
          // free resources used by report
          report.Dispose();
    

    3) run your app and press the button. Design a report and save it to a file.
    4) to run the report, use the following code:
          // create report instance
          Report report = new Report();
    
          // load the existing report
          report.Load("your_report.frx");
    
          // register the business object the same way as when you design a report
          report.RegisterData(Your_Business_Object, "name_of_BO");
    
          // run the report
          report.Show();
    
          // free resources used by report
          report.Dispose();
    

    In this way, you work with "live" data when designing a report and when previewing it. Later you may remove the "design a report" button from your app, or you may decide to keep this functionality (as it is royalty-free) - it will allow you to create/modify reports without need to recompile your app. This approach was used in the main demo program to create all demo reports.
  • edited 5:18AM
    Hello,

    I think there are missing understand
    Let's ask in another way

    In FastRepoet Demo "DataFromBusinessObject "
    How could you add the "Categories" object (that designed in Form Class) to the FastRepoet Datasource in design Time (to enable me design my report in design Time) ??
  • edited 5:18AM
    Use BindingSource component. But you will work with no data while designing a report. Why don't you like the solution described in my previous post?

Leave a Comment