18.5. COM Interop using C# 4.0 Language Features
Assume you have a Windows Form GUI application (named ExportDataToOfficeApp), whose main Form defines a DataGridView named dataGridCars. This same form has two Button controls, one of which will bring up a dialog box to insert a new row of data to the grid, and the other of which needs to export the grid's data to an Excel spreadsheet. Given the fact that the Excel application exposes a programming model via COM, you can hook into this object model using the interoperability layer. Figure 18-9 shows the completed GUI.
Figure 18.9. The GUI of the COM interop example
You will fill the grid with ...
Get Pro C# 2010 and the .NET 4 Platform, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.