Specifies whether the control should handle Windows messages while rendering reports.

Namespace:  C1.C1Report
Assembly:  C1.C1Report.2 (in C1.C1Report.2.dll)

Syntax

C#
[DefaultValueAttribute(true)]
public bool DoEvents { get; set; }
Visual Basic
<DefaultValueAttribute(True)> _
Public Property DoEvents As Boolean
	Get
	Set

Remarks

Setting this property to true allows users to resize forms, click buttons, etc. while reports are being generated. This makes applications more responsive, and is necessary if you want to provide a "Cancel Report" button (otherwise users wouldn't be able to click the button until the report was done).

Setting this property to false will cause reports to render slightly faster.

The default value for this property is True.

Examples

The following code implements a Render button and a Cancel button attached to a C1Report component.

The Render button checks whether the C1Report component is busy before starting to render a report. This is necessary because the user could click the Render button several times in a row, before the component got a chance to finish rendering the report. (Calling the Render()()()() method while the component is busy throws a Exception).

The Cancel button checks whether the component is rendering a report and sets the Cancel property to true. Use the following code:

Copy CodeVisual Basic
c1r.DoEvents = True
Private Sub Render_Click(sender As Object, e As EventArgs)
    If c1r.IsBusy Then
        Console.WriteLine("Cannot render now, component is busy")
    Else
        ppv.Document = c1r.Document
    End If
End Sub
Private Sub Cancel_Click(sender As Object, e As EventArgs)
    If c1r.IsBusy Then
        c1r.Cancel = True
    Else
        Console.WriteLine("No report to cancel")
    End If
End Sub
Copy CodeC#
c1r.DoEvents = true;
private void Render_Click(object sender, EventArgs e)
{
    if (c1r.IsBusy)
    {
        Console.WriteLine("Cannot render now, component is busy");
    }
    else
    {
        ppv.Document = c1r.Document;
    }
}
private void Cancel_Click(object sender, EventArgs e) 
{
    if (c1r.IsBusy) 
    {
        c1r.Cancel = true;
    }
    else
    {
        Console.WriteLine("No report to cancel");
    }
}

See Also