Reports for WinForms | ComponentOne
Working with C1RdlReport / Loading an RDL File
In This Topic
    Loading an RDL File
    In This Topic

    To load an RDL file into the C1RdlReport component you can use the Load method. To remove an RDL file, you would use the Clear method. This method clears any RDL file previously loaded into the C1RdlReport control. The C1RdlReport component includes design-time options to load and clear an RDL file.

    To load an RDL file in the Tasks menu:

    Complete the following steps:

    1. In Design View, click the C1RdlReport component's smart tag to open the C1RdlReport Tasks menu.
    2. In the C1RdlReport Tasks menu choose Load Report. The Open dialog will appear.
    3. In the Open dialog box, locate and select an RDL file and then click Open.

    The report will be loaded and if the C1RdlReport control is connected to a previewing control, such as C1PrintPreviewControl, the report will appear previewed in the previewing control at design time.

    To load an RDL file in code:

    To load an RDL file into the C1RdlReport component you can use the Load method. Complete the following steps:

    1. In Design View, double-click on the form to open the Code Editor.
    2. Add the following code to the Load event, replacing "C:/Report.rdl" with the location and name of the RDL file you want to load.

      To write code in Visual Basic

      Visual Basic
      Copy Code
      C1RdlReport1.Load("C:/Report.rdl")
      C1RdlReport1.Render()
      

      To write code in C#

      C#
      Copy Code
      c1RdlReport1.Load(@"C:/Report.rdl");
      c1RdlReport1.Render();
      

    The report will be loaded and if the C1RdlReport control is connected to a previewing control, such as C1PrintPreviewControl, when you run the application, the report will appear in the previewing control.