# C1.Report.FlexReport.DoEvents

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Report_FlexReport_DoEvents_" data-uid="C1.Report.FlexReport.DoEvents*">DoEvents Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Report_FlexReport_DoEvents_" data-uid="C1.Report.FlexReport.DoEvents*"></a>
<h4 id="C1_Report_FlexReport_DoEvents" data-uid="C1.Report.FlexReport.DoEvents">DoEvents</h4>
<div class="markdown level1 summary"><p>Specifies whether the control should handle Windows messages while rendering reports in synchronious mode.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">[C1Category(&quot;Behavior&quot;)]
[C1Description(&quot;C1FlexReport.DoEvents&quot;, &quot;Indicates whether Windows messages should be processed while rendering the report.&quot;)]
public bool DoEvents { get; set; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">&lt;C1Category(&quot;Behavior&quot;)&gt;
&lt;C1Description(&quot;C1FlexReport.DoEvents&quot;, &quot;Indicates whether Windows messages should be processed while rendering the report.&quot;)&gt;
Public Property DoEvents As Boolean</code></pre>
</div>
<h5 id="C1_Report_FlexReport_DoEvents_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Setting this property to true allows users to resize forms, click buttons, etc. while reports are 
being generated in synchronious mode. 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).</p>
<p>Setting this property to false will cause reports to render slightly faster.</p>
</div>
<h5 id="C1_Report_FlexReport_DoEvents_examples">Examples</h5>
<p>The code below implements "Render" and a "Cancel" buttons attached to a <a class="xref" href="C1.Report.FlexReport.html">FlexReport</a> component.</p>
<p>The "Render" button checks whether the <a class="xref" href="C1.Report.FlexReport.html">FlexReport</a> 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 <a class="xref" href="C1.Report.FlexReport.Render.html#C1_Report_FlexReport_Render">Render()</a> method while the component is busy throws an 
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.exception">Exception</a>).</p>
<p>The "Cancel" button checks whether the component is rendering a report and sets the <a class="xref" href="C1.Report.FlexReport.Cancel.html#C1_Report_FlexReport_Cancel">Cancel</a> 
property to true.</p>
<pre><code class="lang-csharp">_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;
   } 
}
private void Cancel_Click(object sender, EventArgs e) 
{
   if (_c1r.IsBusy) 
   {
       _c1r.Cancel = true;
   } 
   else 
   {
       Console.WriteLine("No report to cancel");
   }
}</code></pre>

</div>
