This example shows how to render a report in the thread. Rendering the report in the thread is run in the background process. For this purpose the BackgroundWorker class is used:
private System.ComponentModel.BackgroundWorker backgroundWorker1;

private void button1_Click(object sender, EventArgs e)
{
	backgroundWorker1.RunWorkerAsync();
}

In the start of the backgroundWorker1_DoWork() process event, you can dload the report and connect data. Also you should subscribe to the Rendering() event of the compiled report object:
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
	using (var stream = Assembly.GetExecutingAssembly().
		GetManifestResourceStream("RenderInThread.Master-Detail-Subdetail.mrt"))
	{
		report.Load(stream);
	}

	report.IsRendered = false;
	report.Compile();
	report.CompiledReport.Rendering += new EventHandler(CompiledReport_Rendering);
	report.Render(false);
}

In the CompiledReport_Rendering() event update the text on the form - show a value of the StatusString property. After completion of the thread work, show the report in the viewer:
void CompiledReport_Rendering(object sender, EventArgs e)
{
	button1.Invoke((EventHandler)delegate { button1.Text = report.StatusString; });
}

private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
	report.Show();
}

Auf dem Screenshot unten Sie können das Ergebnis des Beispiel-Codes ansehen:

Rendering a Report in the Thread

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.