Using FastReport.Net with visual studio 2005

edited 2:09AM in FastReport .NET
Hello,
I want to know how to use a report made with fastReport.Net in a project visual studio.Net be cause the file created bwith FR.Net is a '.frx'. This type of file is not recognize in visual studio 2005.
Thank for your answer.
«1

Comments

  • edited 2:09AM
    Hello,

    Since the FastReport.Net is demo now, you need to perform some steps to use it in the VS2005.
    - in the VS2005, right-click the Toolbox and select "Choose Items...";
    - click "Browse..." button and select the "FastReport.dll" file;
    - close the dialog. Now you will see two FastReport items in the Toolbox: "Report" and "PreviewControl";
    - put the "Report" item on your form;
    - right-click it and choose "Select Data Source..." to select application-defined dataset or its tables;
    - right-click it again and choose "Design Report..." to run the designer.
    You may design a new report or open the existing one. To run a report, write the following code in the event handler:
    report1.Show();
  • edited 2:09AM
    Hello Alex,
    i try using the .Net component in VBS2005 and have the following problem:

    I can put a report on a form, no problem, and after right clicking it with the mouse at the menu "Design Report...."
    i get a report editor with a layout where a data field is included.

    Now the problem: After selecting the datasource form my database, i should see the complete report in form of a table, or is this not correct?
    Or must i define a table to get the data shown on the report?

    Kind Regards,
    Ralf
  • edited 2:09AM
    Hello,

    Not sure if I understand you correctly.
    You have to create the report layout by yourself. You also may use the "Standard report wizard" (select File|New...|Standard report wizard") to create the report.
  • edited 2:09AM
    Hi Alex,
    yes i understand, so i must use a table, label or whatever to create manualy the report, correct!?

    Using the wizard results in nothing, i mean after finishing the Wizard, where is the report i created?
    I only see the blank report like befor (after starting Fast Report by right clicking the object in VS2005).

    Also: When FR is started is does not apear in the task manager, so when slecting other windows,
    it hard to find again, only by using Alt+Tab.

    Ralf
  • edited 2:09AM
    Hello,

    - Yes, you should create the layout by using bands and objects like Text, Picture, and so on.
    - I've fixed the wizard. I've also switched on the ShowInTaskbar option for the designer.
  • edited 2:09AM
    Hi Alex,
    thanks for your support.
    All works fine now, i will go on testing the beta component in the moment in our application.

    There are some problems i saw:
    - How to make a kind of template? The Wizard starts with an empty form, but if i have a kind
    of template (logo & address included for example) i would like to use this.
    - Inluding a picture on the form results sometimes in a wrong scaling of the image. If a image (jpg)
    is loaded in a picture box, it appears very small, also changing the SizeMode doesn't bring
    any better results.

    A question: How to change the report (frx-file) at run time for a component?

    Kind Regards,
    Ralf


  • edited 2:09AM
    Hello,

    1) there is no templates support in the wizard. However you can make a template and save it to a file. Next time when you need to create a new report, open this file, modify it and save new report with different name.
    2) I've tried to play with images but everything works as expected for me. Can you tell me the exact seqence of actions?
    3) Do you need to change a report in code? Or just load a file into the Report component?
  • edited 2:09AM
    Hi again,
    see my answers below:

    1) there is no templates support in the wizard. However you can make a template and save it to a file. Next time when you need to create a new report, open this file, modify it and save new report with different name.
    => OK, i will try this.

    2) I've tried to play with images but everything works as expected for me. Can you tell me the exact seqence of actions?
    => I have a logo, 200x200pixel, 5k, Jpg, i load it in the picture box, it appears bigger than the picture box. After that
    i use preview, than i see the logo very small, i close the preview, than it is in the designer also very small (smaller than the box)
    and it is not possible to fit the image into the box by changing "SizeMode":
    Normal: Image smaller than Box (2 x 2cm)
    Stretch: Image becomes smaller than in "SizeMode = Normal, Box stays 2 x 2cm
    AutoSize, Center, Zoom: Image bigger, but box becomes also very big now (6 x6 cm)
    ...hope this helps.

    3) Do you need to change a report in code? Or just load a file into the Report component?
    => I want to use only one report object, but i will load different reports in it at run time, it shall be selected in a small menu.

    Kind Regards,
    Ralf
  • edited 2:09AM
    Could you send me the logo? I cannot reproduce this. Also tell me which system do you use, the screen resolution and dpi setting (normal/large fonts).
    To load a report, use the report.Load(filename).
  • edited 2:09AM
    Hi Alex,
    the System is a DELL Workstation, Resolution is 1920 x 1200, 96DPI.
    Logo attached.
    Ralf


  • edited 2:09AM
    I have fixed it, it was an image resolution problem. The fixed version will be available for download in this midnight.
  • edited August 2008
    Hi Alex,
    works fine now, thanks.

    Next problem (or i have a misunderstanding):

    The Property "PrintOn" of the Report Title is set to "FirstPage, LastPage, OddPages, EvenPages",
    but it is only printed on the first page. The Property of the Page Footer seems to work correct.

    Kind Regards,
    Ralf
  • edited 2:09AM
    Hello,

    That's right because ReportTitle band is printed only once on the first report page. So this property has no meaning for this band, it cannot force the ReportTitle to be printed on last page, for example.
  • edited 2:09AM
    Hi Alex,
    but this makes no sense to me. If you have for example a delivery note or what ever, which
    needs more space than one sheet, it is usefull to have the header (logo, company name ...) on
    all pages. Do you agree?

    Kind Regards,
    Ralf


  • edited 2:09AM
    If you want to print something on all pages, use the PageHeader/PageFooter bands.
  • edited 2:09AM
    Hi Alex,
    i am back:

    =>If you want to print something on all pages, use the PageHeader/PageFooter bands.<=

    But how to move the PageHeader on Top of the sheet? This doesn't work, it is always
    at the second position, under the Report Title, you can also not move it on top when using
    "Configire Bands". So the Page Header should be on top, for example to have a logo
    and whatever always on top of all pages. In a delivery note or in an invoice for example these things
    are always on top. It is also not possible to define a second page header, this would be important
    when creating a formular with logo & adderess at the first page, and only a logo at all other pages.
    This is for example done in a delivery note, invoice....

    Kind Regards,
    Ralf
  • edited 2:09AM
    Hi Alex,
    there is an other question coming from a previous post:

    How to filter the data by the main application? So after loading the report,
    it needs to be filtered by giving a filter-value in a specific column.

    Kind Regards,
    Ralf
  • edited 2:09AM
    1) By default the ReportTitle is printed on top. Change the page's property "TitleBeforeHeader" if you want to change it.
    2) Set the PageHeader's "PrintOn" property to "FirstPage". Add a Child band to PageHeader and set its "PrintOn" property to "OddPages,EvenPages,LastPage". See the "Features|Odd-even pages, mirror margins" report, it uses the same technique to print different headers on odd/even pages.
    3) The DataBand has property "Filter". It can contain any valid C# expression, for example:
    [Customers.CustomerID] == 10000
    You can define the variable (it can be done in the "Data" window) and change its value from your application:
    report1.SetParameterValue("YourParameter", 10000)
    This variable can then be used in any expression. So your data filter expression may be
    [Customers.CustomerID] == [YourParameter]
  • edited 2:09AM
    Hi Alex,
    sorry for asking, but i don't know what you mean with "Data" window?
    In the data field on the left side, there is no possibility to define a variable.
    Or am i wrong?
    Regards,
    Ralf

  • edited 2:09AM
    Alex,
    i found it, it is in the "Data Dictionary" => "Actions" => "New Parameter", correct?
    I defined there a var, which i use then in the filter property of the data band: [tbl_artikel.Artikel_ID]==[artikel_filter]
    After that i added the following code to my application:

    Dim artikel_filter As Integer
    artikel_filter = 7000001
    Report_Artikel.Load("..\..\reports\artikeldetails.frx")
    Report_Artikel.SetParameterValue("artikel_filter", artikel_filter)
    Report_Artikel.Show()

    Starting the application and calling the code above results in a crash with the error message:
    "System.StackOverflowException" in mscorlib.dll, sometime the message comes with "fastreport.dll"

    Kind Regards,
    Ralf
  • edited 2:09AM
    Hello,

    Strange, it works well for me. Probably you need to set the parameter's DataType property.
    Could you prepare a test application and send it to my email?
  • edited 2:09AM
    Hi alex,
    a test app is heavy, i have a mysql database on a server behind it.
    The DataType property is int32, i use also integer for this field.
    The Expression of this parameter is [artiekl_filter] (Why does it use brackets, is this correct?)

    Ralf
  • edited 2:09AM
    Alex,
    there is also something other to mention:
    When using the preview function in the designer, i get the error message CS0103
    Ralf

  • edited 2:09AM
    Please clarify.
    You have a parameter called "artikel_filter" which "Expression" property is set to "[artikel_filter]"?
  • edited 2:09AM
    Hi Alex,
    i have done the following:

    1. In "Data Dictionary" => "Actions" i generated a "New Parameter", i named it "artikel_filter", DataType = Int32, Expression = "" (empty, nothing, nix)

    2. In the Data-Object (was previously defined with the Wizard to "my_database.tbl_artikel"), i assigned the property "Data / Filter" to "[tbl_artikel.Artikel_ID]==[artikel_filter]".

    3. I saved the report as "artikeldetails.frx"

    4. In my application i try to call the report by uasing following code:

    Dim artikel_id As Integer
    artikel_id = 7000001
    Report_Artikel.Load("..\..\reports\artikeldetails.frx")
    Report_Artikel.SetParameterValue("artikel_filter", artikel_id)
    Report_Artikel.Show()

    Thats all.

    When calling the code in my application, the program crashes and i get the message => "....System.StackOverflowException" in mscorlib.dll......

    Regards,
    Ralf
  • edited 2:09AM
    Ralf,

    I do the same and it works well. I use the "Simple list" demo report here.
    - add a new parameter "MyParam" in the Data Dictionary, DataType is Int32
    - double-click the Data band, switch to "Filter" tab, set filter expression to
    [Employees.EmployeeID]==[MyParam]
    - save the report

    The application code:
    FReport.Load("testreport.frx");
    RegisterData(); // registers all demo datasources
    FReport.SetParameterValue("MyParam", 5); // 5 is ID of Steven Buchanan
    FReport.Show();

  • edited 2:09AM
    Hi Alex,
    it works now, i made the report completely new but i don't know what was the reason!
    I will come back later again, may be i find the reason.
    Kind Regards,
    Ralf
  • edited 2:09AM
    Hello Alex,
    i am back with one question:

    I have on a report a table and i want to write from my application into one ore more cells.
    => Report.table1.cell1.text = "blablabla" does not work.
    How is the syntax?

    Thanks,
    Ralf
  • edited 2:09AM
    Hello,

    The correct syntax is:

    TableCell cell = report1.FindObject("Cell1") as TableCell;
    cell.Text = "...";
  • edited 2:09AM
    Is this delphi code?
    I write in VB, i never wrote in delphi.

    Kind Regards,
    Ralf

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.