Share via


Calling the Methods to Perform the Export

You are now ready to create the button click event method for the exportByType Button control, and then call the methods to perform the export from that event method.

To create the exportByType_Click event method

  1. Open the Web or Windows Form.

  2. From the View menu, click Designer.

  3. Double-click the exportByType Button control.

The exportByType\_Click() event method is created and displayed in Code view.
  1. Within the exportByType_Click() event method, enter calls to the three event methods that you created earlier to perform the export.
``` vb
ExportSetup()
ExportSelection()
ExportCompletion()
```

``` csharp
ExportSetup();
ExportSelection();
ExportCompletion();
```

You are now ready to build and run your project, and then export your report in multiple formats.

To test the project

  1. From the Build menu, select Build Solution.

  2. If you have any build errors, go ahead and fix them now.

  3. From the Debug menu, click Start.

The Web or Windows application compiles and displays the Hierarchical Grouping report. A DropDownList control shows multiple export formats, and an Export As Selected Type button is displayed to perform the export.
  1. Select one of the export formats from the DropDownList control, and then click the Export As Selected Type button.
A message appears next to the button that indicates whether the export has been successful. If not successful, an error message is shown.
  1. Try to export in several different formats.

  2. Return to Visual Studio and click Stop to exit from debug mode.

  3. Check the Exported file directory on your Web server or Windows machine to confirm that the exported files have been placed in the directory.