# C1.Win.FlexGrid.Util.BaseControls.ScrollableControl.DeferUpdate

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_FlexGrid_Util_BaseControls_ScrollableControl_DeferUpdate_" data-uid="C1.Win.FlexGrid.Util.BaseControls.ScrollableControl.DeferUpdate*">DeferUpdate Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_FlexGrid_Util_BaseControls_ScrollableControl_DeferUpdate_" data-uid="C1.Win.FlexGrid.Util.BaseControls.ScrollableControl.DeferUpdate*"></a>
<h4 id="C1_Win_FlexGrid_Util_BaseControls_ScrollableControl_DeferUpdate" data-uid="C1.Win.FlexGrid.Util.BaseControls.ScrollableControl.DeferUpdate">DeferUpdate()</h4>
<div class="markdown level1 summary"><p>Suspends notifications until the returned <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.idisposable">IDisposable</a>
object is disposed.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public IDisposable DeferUpdate()</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function DeferUpdate() As IDisposable</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.idisposable">IDisposable</a></td>
      <td><p>An <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.idisposable">IDisposable</a> object that must be disposed to restore notifications.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_FlexGrid_Util_BaseControls_ScrollableControl_DeferUpdate_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This method is typically used in update blocks to perform batch updates efficiently
and safely.</p>
</div>
<h5 id="C1_Win_FlexGrid_Util_BaseControls_ScrollableControl_DeferUpdate_examples">Examples</h5>
<p>The example below shows how you can use the <b>DeferUpdate</b> method to suspend
notifications while setting the width of several columns.</p>
<p>Note that the call to the <b>DeferUpdate</b> method is placed in a <b>using</b>
statement, which automatically disposes of the object and restores updates
at the end of the block, even if the code within the block throws an exception.
This makes the code more readable and concise than calling the more traditional 
<b>BeginUpdate</b> and <b>EndUpdate</b> methods within a try/finally block.</p>
<pre><code class="lang-csharp">var grid = new C1FlexGrid();
using (grid.DeferUpdate())
{
  foreach (Column col in grid.Columns)
  {
    col.Width = 100;
  }
}</code></pre>

</div>
