Visual Basic (Declaration) | |
---|---|
Sub EndUpdate() |
C# | |
---|---|
void EndUpdate() |
Demonstrate using a workbook set in a thread safe manner when accessing the SpreadsheetGear API many times.
C# | Copy Code |
---|---|
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 | Copy Code |
---|---|
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 |
This method is thread safe.
EndUpdate releases the lock which was acquired by BeginUpdate by calling GetLock.
See GetLock and SpreadsheetGear.IWorkbookSet.ReleaseLock for more information about acquiring and releasing locks and the effect this has on background calculation.
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family