Wednesday, September 14, 2005

Barcode Data Binding in .NET Windows Forms 2.0

One of the enhancements in .NET 2.0 is the new Windows Forms Data Binding capabilities. You can create with few steps and time data-enabled forms using Visual Studio .NET 2005. Select a Data Source (provided by a Web Service, a Database, or a Business Entity) and then specify for each data source’s “field” a Windows Forms Control that will represent it onto the form (Data Source pane on figure). You can enable your custom control for data-binding adding a simple class-level Metadata Attribute. There’re tree different attributes to use depending on your needs, DefaultBindingPropertyAttribute, ComplexBindingPropertiesAttribute, or LookupBindingPropertiesAttribute. In our case we just use the first one.
If you do not do that, your control will not be allowed to participate in the data-binding process as is stated in .NET 2.0 help:

"You can modify the list of controls associated with each data type by selecting Customize from the list attached to any item in the Data Sources window. The list of Associated controls is determined by the available controls in the Toolbox that implement one of the following databinding attributes: DefaultBindingPropertyAttribute, ComplexBindingPropertiesAttribute, or LookupBindingPropertiesAttribute."

Realize that your control must be in the Toolbox before you can bind it with any data type.
Here, a screenshot of our Barcode Professional 2.5 for Windows Forms 2.0 under beta at this moment.


Post a Comment

<< Home