# C1.C1Preview.C1MultiDocument.DoEvents

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_C1Preview_C1MultiDocument_DoEvents_" data-uid="C1.C1Preview.C1MultiDocument.DoEvents*">DoEvents Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_C1Preview_C1MultiDocument_DoEvents_" data-uid="C1.C1Preview.C1MultiDocument.DoEvents*"></a>
<h4 id="C1_C1Preview_C1MultiDocument_DoEvents" data-uid="C1.C1Preview.C1MultiDocument.DoEvents">DoEvents</h4>
<div class="markdown level1 summary"><p>Gets or sets a value indicating whether the current <a class="xref" href="C1.C1Preview.C1MultiDocument.html">C1MultiDocument</a>
should handle Windows messages while generating.</p>
<p>The default value is false.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public bool DoEvents { get; set; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Property DoEvents As Boolean</code></pre>
</div>
<h5 id="C1_C1Preview_C1MultiDocument_DoEvents_remarks">Remarks</h5>
<div class="markdown level1 remarks"><pre><code>&lt;p&gt;Setting this property to true allows users to resize forms, click buttons, etc. while documents are 
</code></pre>
<p>being generated. This makes applications more responsive, and is necessary if you want to provide a
&quot;Cancel&quot; button to stop the document generation (otherwise the user wouldn't be able to click the
button until the generation is complete).</p>
<p>Setting this property to false will cause documents to generate slightly faster.</p>
</div>
<h5 id="C1_C1Preview_C1MultiDocument_DoEvents_examples">Examples</h5>
<pre><code>&lt;p&gt;The code below implements &quot;Generate&quot; and &quot;Cancel&quot; buttons attached to a &lt;xref href=&quot;C1.C1Preview.C1PrintDocument&quot; data-throw-if-not-resolved=&quot;false&quot;&gt;&lt;/xref&gt;.&lt;/p&gt;
&lt;p&gt;The &quot;Generate&quot; button checks whether the document is busy before starting to generate it.
</code></pre>
<p>This is necessary because the user could click the &quot;Generate&quot; button several times in a row, before the document got a
chance to finish generating. (Calling the <a class="xref" href="C1.C1Preview.C1MultiDocument.Generate.html#C1_C1Preview_C1MultiDocument_Generate">Generate()</a> method while the component is busy throws an
exception.)</p>
<p>The &quot;Cancel&quot; button checks whether the document is currently generating, and sets the <a class="xref" href="C1.C1Preview.C1MultiDocument.Cancel.html#C1_C1Preview_C1MultiDocument_Cancel">Cancel</a>
property to true if it is.</p>
<pre><code>&lt;pre&gt;&lt;code class=&quot;lang-csharp&quot;&gt;_doc.DoEvents = true;

private void Generate_Click(object sender, EventArgs e)
{
   if (_doc.BusyState != BusyStateEnum.Ready)
       Console.WriteLine(&quot;Cannot generate now, document is busy&quot;);
   else 
       _doc.Generate();
}
private void Cancel_Click(object sender, EventArgs e) 
{
   if (_doc.BusyState != BusyStateEnum.Ready) 
       _doc.Cancel = true;
   else 
       Console.WriteLine(&quot;Document is not generating, nothing to cancel&quot;);
}&lt;/code&gt;&lt;/pre&gt;
</code></pre>

</div>
