It has been a while since I have been written about the Windows Forms version of TX Text Control. And that is not because we give the Windows Forms version less priority - it is just my current dedication towards reporting, ASP.NET and web development.

The client versions including Windows Forms and WPF have a very high priority for us. Sure, web application's popularity is growing fast and our ASP.NET team is doing a great job to fulfill all requests and requirements from our users. But we understand that millions of end-users are using Windows desktop applications with TX Text Control, so we are investing time and money into the development of new and improved features for these platforms as well.

In this sample, we show how to use a BindingNavigator and a BindingSource to preview merge results.

Windows Forms: Preview mail merge results with the BindingNavigator and a BindingSource

The sample form consists of a TextControl with an attached button bar, rulers and status bars. Additionally, a MailMerge component, a BindingNavigator and a BindingSource has been added to the form.

Windows Forms: Preview mail merge results with the BindingNavigator and a BindingSource

The BindingSource property of the BindingNavigator is set to the instance of the BindingSource.

In code, a new DataSet is created by reading an XML data file. The DataSource property of the BindingSource is set to the root table of the created DataSet.

Loading...

In the CurrentChanged event of the BindingSource, a temporary table clone with only the current row is created and used to merge the template.

Loading...

This way, the current data row is merged instantly when the user navigates to another row using the BindingNavigator control.

Download the sample from GitHub and test it on your own.

GitHub

Download and Fork This Sample on GitHub

We proudly host our sample code on GitHub.com/TextControl.

Please fork and contribute.

Requirements for This Sample

  • Visual Studio 2012 or better
  • TX Text Control .NET for Windows Forms (trial sufficient)