Version

Export WinGrid Asynchronously

The WinGridExcelExporter™ component enables you to asynchronously export your entire WinGrid™ directly into a Microsoft Excel file. You do this by calling the ExportAsync method of the UltraGridExcelExporter object.

Introduction

Asynchronous exporting, as opposed to synchronous, allows users to interact with the user interface of the application while the export process is executing. You must ensure that neither the WinGrid, nor its data source is accessed by your application in any way while the asynchronous export is in progress. The IsExportAsyncInProgress property of the WinGrid is used to determine whether or not the asynchronous export is still in progress to avoid any access conflicts.

Requirements

  • A Microsoft Visual Studio solution using .NET Framework 3.0 or higher

  • A Windows Forms Application Solution using the WinGrid and bound to data

  • A WinGridExcelExporter control on the form

Steps

  1. Export the WinGrid asynchronously.

In C#:

this.ultraGridExcelExporter1.ExportAsync(this.ultraGrid1, "C:\\Reports\\ExcelExport.xls");

In Visual Basic:

Me.UltraGridExcelExporter1.ExportAsync(Me.UltraGrid1, "C:\Reports\ExcelExport.xls")
  1. (Optional) Verify the result.

To verify the result, run your application and perform the export (Figure 1).

WinGridExcelExporter Export WinGrid Asynchronously 01.png

Figure 1: WinGrid asynchronously exporting to a Microsoft Excel file