# C1.C1Preview.C1PrintDocument.ErrorScript

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_C1Preview_C1PrintDocument_ErrorScript_" data-uid="C1.C1Preview.C1PrintDocument.ErrorScript*">ErrorScript Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_C1Preview_C1PrintDocument_ErrorScript_" data-uid="C1.C1Preview.C1PrintDocument.ErrorScript*"></a>
<h4 id="C1_C1Preview_C1PrintDocument_ErrorScript" data-uid="C1.C1Preview.C1PrintDocument.ErrorScript">ErrorScript</h4>
<div class="markdown level1 summary"><p>Gets or sets the script that is executed when an error occurs in a script attached to the current document.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public string ErrorScript { get; set; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Property ErrorScript As String</code></pre>
</div>
<h5 id="C1_C1Preview_C1PrintDocument_ErrorScript_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>
The <a class="xref" href="C1.C1Preview.C1PrintDocument.ErrorScript.html#C1_C1Preview_C1PrintDocument_ErrorScript">ErrorScript</a> event is also fired at the same time
as this script is executed.
</p>
<p>
The difference between events and scripts is that event handlers
belong to the application code, while scripts belong to the document.
Thus it is recommended that event handlers be used to perform tasks that
implement the overall application logic but do not depend on the
specific document being processed.
</p>
<p>
On the other hand, scripts should be used to perform tasks directly related
to the document itself. Scripts attached to a document are executed regardless
of the current application (e.g. when the document is regenerated after 
being loaded from file by a different program).
(For example, a document might contain a script that changes the value
of a field in that document when an error occurs.)
</p>
</div>
</div>
