Search code examples
c#formscrystal-reportsreportviewer

Values between windows forms in C# .NET


I have two forms, in the main one a have a crystalreportviewer and in the other one the user introduces the ID of the user he wants to be on the report. The problem I want the user to introduce the ID before the report loads the information, so when the user clicks the CreateReport button just before the report loads the info, I created a new form to introduce the ID, the problem is that instructions continue to execute even though the new window is open. I know is a problem of logic instead of programmin maybe you can help me =). I made a constructor in the form so the values can be passed.

Here is the code of the button:

    private void usuariosToolStripMenuItem_Click(object sender, EventArgs e)
    {

            RPE formRPE = new RPE(); //NEW FORM CREATED
            frmRPE.Show();//RPE FORM CALLED
            this.Hide();

        //BUT IT GOES ON

            ReportDocument guantesRpt = new reporteGuantes();

            DataTable datatableGuantes = reporteguantes.obtenerTabla();
            guantesRpt.SetDataSource(datatableGuantes);





            rptViewerGuantes.ReportSource = guantesRpt;
            //  Usuariorpt.SetParameterValue("RPE", RPE);



    }

Solution

  • ShowDialog(...)