1613561 - How to call a Windows form containing the CrystalReportViewer control on a separate thread.

SAP Knowledge Base Article - Public

1613561 - How to call a Windows form containing the CrystalReportViewer control on a separate thread.

Symptom

  • A Windows form containing the CrystalReportViewer control.
  • Need to call this form on a separate thread.

Environment

  • Visual Studio 2003/2005/2008
  • Crystal Reports 2008

Resolution

See below code. 


static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

Thread t = new Thread(ShowForm);
t.SetApartmentState(ApartmentState.MTA);
t.Start();



}


static void ShowForm()
{


Form1 objForm1 = new Form1();
objForm1.ShowDialog();


}


}

See Also

For more information on calling a Windows form on a separate thread refer to the following url's. 

http://msdn2.microsoft.com/en-us/library/system.threading.thread(vs.71).aspx

http://support.microsoft.com/kb/815804

Keywords

application, desktop, multithreaded, two , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

Crystal Reports 2008 V0 ; Crystal Reports 2008 V1