StrataFrame with Report Sharp-Shooter


Author
Message
Rogerio Mauri
Rogerio Mauri
StrataFrame User (251 reputation)StrataFrame User (251 reputation)StrataFrame User (251 reputation)StrataFrame User (251 reputation)StrataFrame User (251 reputation)StrataFrame User (251 reputation)StrataFrame User (251 reputation)StrataFrame User (251 reputation)StrataFrame User (251 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
If you received the error below when choosing an option of the menu of previewForm

Crying-------------------------------------------------
ThreadStateException
O thread atual deve ser definido no modo STA (single thread apartment) antes que chamadas OLE possam ser feitas. Verifique se a função Main tem STAThreadAttribute marcado. A exceção somente será gerada se um depurador estiver anexado ao processo.

Source : System.Windows.Forms
-------------------------------------------------


It sees the code below to solve the problem:

Wink
#region CodeArea(StrataFrame with Report Sharp-Shooter) in new Thread(STA)

private void inlineReportSlot2_RenderCompleted(object sender, EventArgs e)
{
    Thread newThread = new Thread(new ThreadStart(Exibe));
    newThread.SetApartmentState(ApartmentState.STA);
    newThread.Start();
}

void Exibe()
{
    Thread.Sleep(0);
    using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot2))
    {
        previewForm.WindowState = FormWindowState.Maximized;
        previewForm.ShowDialog();
    }
}

#endregion


 

Rogério Mauri Smile



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search