Step 3 of 4: Adding Code to the Project
Now that you've added the Reports for WinForms controls to the form and customized the form and controls, there's only one last step left before running the project. In this step you'll add code to the project to set the text that appears in the project.
1. Double-click the form's title bar to switch to code view and create a handler for the Form_Load event.
2. Add the following code to the Form_Load event to add text to the preview document:
Me.C1PrintDocument1.Body.Children.Add(New C1.C1Preview.RenderText("Hello, World!"))
• C#
this.c1PrintDocument1.Body.Children.Add(new RenderText("Hello, World!"));
3. Add the following code to the Form_Load event to generate the document:
Me.C1PrintDocument1.Generate()
• C#
this.c1PrintDocument1.Generate();
You've added code to the project and completed step 3 of the printing and previewing quick start guide. In the last step you'll run the program.
|