Close WinForm after FastReport is Closed?

I am using FastReport.Net within Visual Studio 2015 to create a new report. I am writing my code in Visual Basic .Net.

I created a new report by adding a new Windows Form to my VB.Net application. I dragged and dropped the Report component onto the new form. Then I right-clicked on Report1 and selected Select Data Source and selected the Access Database that contains the table that is the data source for the report. Finally, I clicked on Design Report and used the FastReport designer to design the report.

After I preview the report on screen and then close it, the Windows Form that was used in building the report is visible and I must then manually close it. How do I get the Windows Form to close when the Report is closed? I can't find a way to get this Windows form to close at the same time that the report closes. How is this done? What am I doing wrong?

Comments

  • StarkStark Syria
    edited 2:45PM
    This is in C#, hope this help.

    Add the modal Parameter to ".Show()" function -> ".Show(true)";
  • edited April 2016
    BobV365 wrote: »
    I am using FastReport.Net within Visual Studio 2015 to create a new report. I am writing my code in Visual Basic .Net.

    I created a new report by adding a new Windows Form to my VB.Net application. I dragged and dropped the Report component onto the new form. Then I right-clicked on Report1 and selected Select Data Source and selected the Access Database that contains the table that is the data source for the report. Finally, I clicked on Design Report and used the FastReport designer to design the report.

    After I preview the report on screen and then close it, the Windows Form that was used in building the report is visible and I must then manually close it. How do I get the Windows Form to close when the Report is closed? I can't find a way to get this Windows form to close at the same time that the report closes. How is this done? What am I doing wrong?

    UPDATE: I later realized that I needed to use the following VB statements behind the report form:

    Private Sub MyReport_Load(Sender As Object, e as EventArgs) Handles MyBase.Load
    Report1.Load("MyFastReport.frx")
    Report1.RegisterData(MyReportDataSet1, "MyReport")
    Report1.Show()
    Me.Close
    EndSub

Leave a Comment