Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Sybase DataWindow .NET 2.0—Easy, Powerful, and Flexible : Page 3

Sybase's DataWindow .NET control simplifies and unifies the process of building both Windows and Web reporting and data-entry applications—without compromising your control of either the data or the visual style.


advertisement
Using DataWindows for Windows Forms
The process to integrate the DataWindow into your .NET application is very simple. Once you understand a few of the key properties of the Transaction object and the DataWindow control, using them is just as simple as using .NET's native controls.

As stated in the overview, the first step is to connect to the database by adding a non-visual transaction object from the toolbox. You can then drag a DataWindowControl from the toolbox to the form. Figure 10 shows the control prior to setting any properties. Setting two properties provides a link to the DataWindow object you created via the DataWindow designer. Setting the LibraryList and DataWindowObject properties immediately shows a sample outline from your data source, but does not show actual data (see Figure 11). The immediate view provides a nice way to lay out your data and forms.

 
Figure 10. An Empty DataWindow Control: Here's how a DataWindow control looks at runtime before you set any of its properties.
 
Figure 11. Immediate View: Although the immediate view doesn't display actual data, it does provide a convenient way to lay out controls on your forms.
As discussed earlier, the following three lines of code allowed the form to connect to the database and retrieve data:

transaction1.Connect(); dataWindowControl1.SetTransaction(transaction1); dataWindowControl1.Retrieve();

To save data back to the database requires two additional lines of code:

dataWindowControl1.UpdateData(true); transaction1.Commit();

The properties and events available for the DataWindow control are expansive. Figure 12 shows the final window running in a Windows Forms application. One nice feature is the drop-down calendar for dates. You configure this component by setting a DataWindow property in the designer. The drop-down calendar works in both Windows Forms and Web Forms applications.

 
Figure 12. Live DataWindow: The figure shows a configured DataWindow at runtime, with live data. Developers can add features such as the drop-down calendar with no coding, by simply setting DataWindow properties.
 
Figure 13. A TreeView Report: This Windows Forms-only report type provides an expandable hierarchical tree view of the report data.
A new DataWindow type available for Windows forms only is a Treeview report. Using the same Wizard-like interface to select the report type (TreeView), data source and query simplifies creating complex data-driven tree views (see Figure 13). The only coding required is the few lines to retrieve the data.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap