Windows Forms Reporting Tutorial

Back to tutorial overview

Windows Forms Reporting - Create your first reporting application

Create your application

  1. Open Visual Studio and create a new Windows Forms application.

    • From the Toolbox, drag and drop an instance of TextControl onto your form.

    • Open the SmartTag in the upper right corner of the TextControl object and visit each wizard link to add additional controls (button bar, rulers, status bar) and connect them by clicking Arrange Controls Automatically.

    • Add a MailMerge component from the toolbox to the form.

  2. Find the SmartTag of the MailMerge component in the component tray. Click Connect to Text Component to connect MailMerge with the TextControl instance.

  3. In the same SmartTag of MailMerge, click Start Template Designer to open TX Text Control Words.

Open sample database and template

  1. Load the sample template Invoice using the Open Sample Template menu entry from the main menu File.

  2. In the newly opened Window, open the Select Data Source drop-down button of the Reports ribbon tab and click Load Sample Database.

  3. Make sure that the table Sales_SalesOrderHeader is selected from the drop-down list button Select Master Table.

  4. Now select Preview Merge Fields from the Preview ribbon tab. Confirm the opened dialog with OK to select the number of records for the preview process.

  5. Uncheck Preview Merge Fields and save the template as a DOCX document using the Save As... menu entry from the main menu File.

Integrate into application

  1. Back in Visual Studio, open the MailMerge SmartTag, click TemplateFile... and browse for the saved template from Step 2.5 in the opened dialog box.

  2. Add a MenuStrip to the form, create a menu item called Merge and double-click this item to open the event handler.

    Add the following code to the event handler and change the XML file location in line 2 to match your TX Text Control installation path:

    C#:

    VB.NET:

  3. Compile and start the application, click the menu item Merge to start the merge process.

 
 
Call us: +1 704-544-7445 (United States)
 
 

Products

Support

Downloads

Corporate

Buy Now

About Text Control

Founded in 1991, Text Control is an award-winning Visual Studio Industry Partner and leading vendor of word processing and reporting components for Microsoft development technologies. The products help thousands of developers add comprehensive word processing functionality to their applications. Text Control is 100% self-owned and independent of all investor decisions. Customers benefit from these years of experience, large user-base, and at the same time, appreciate developing with a mature, reliable product.

SD Times 100SD Times 100SD Times 100SD Times 100SD Times 100SD Times 100Visual Studio 2015 Launch PartnerVisual Studio 2013 Launch PartnerVisual Studio 2012 Launch PartnerVisual Studio Partner