See Also

IWorkbookSet Interface  | IWorkbookSet Members  | BeginUpdate Method  | GetLock Method  | ReleaseLock Method

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Language

Visual Basic

C#

C++

C++/CLI

Show All

See Also Languages SpreadsheetGear The Performance Spreadsheet Component Company 

EndUpdate Method

SpreadsheetGear Namespace > IWorkbookSet Interface : EndUpdate Method

Restores painting and events to the state they were in before the last call to BeginUpdate, releases the lock acquired by BeginUpdate, and starts background calculation if appropriate.

[Visual Basic]
Overridable Sub EndUpdate()
[C#]
virtual void EndUpdate();
[C++]
virtual void EndUpdate();
[C++/CLI]
virtual void EndUpdate();

Remarks

This method is thread safe.

EndUpdate releases the lock which was acquired by BeginUpdate by calling GetLock.

See GetLock and ReleaseLock for more information about acquiring and releasing locks and the effect this has on background calculation.

Example

[C#] Demonstrate using a workbook set in a thread safe manner when accessing the SpreadsheetGear API many times.

void DoSomeThreadSafeWorkQuickly(IWorkbookSet workbookSet) 
        { 
            // Interrupt background calculation if necessary, acquire an 
            // exclusive lock on the workbook set and suspend events and 
            // painting. 
            workbookSet.BeginUpdate(); 
  
            try { 
                // Do a lot of work... 
            } 
            finally { 
                // Release the lock on the workbook set, start background 
                // calculation if appropriate and repaint controls. 
                workbookSet.EndUpdate(); 
            } 
        } 
    

[Visual Basic] 

Sub DoSomeThreadSafeWorkQuickly(ByVal workbookSet As IWorkbookSet)
            ' Interrupt background calculation if necessary, acquire an
            ' exclusive lock on the workbook set and suspend events and
            ' painting.
            workbookSet.BeginUpdate()

            Try
                ' Do a lot of work...
            Finally
                ' Release the lock on the workbook set, start background
                ' calculation if appropriate and repaint controls.
                workbookSet.EndUpdate()
            End Try
        End Sub 'DoSomeThreadSafeWork

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

IWorkbookSet Interface  | IWorkbookSet Members  | BeginUpdate Method  | GetLock Method  | ReleaseLock Method

 

 


See our live Excel Reporting, Excel Charting, Excel to DataGrid and Excel Calculation Samples.

Copyright © 2003-2007 SpreadsheetGear LLC. All Rights Reserved.

SpreadsheetGear and Spreadsheet Gear are trademarks of SpreadsheetGear LLC.