MSDN Magazine Launch Issue - February 15, 2008 - (Page 57) When you think of specific value added when organizations build OBAs, certainly one of the major benefits is the ability to leverage the Office UI to integrate LOB data. This also offloads some of what would otherwise be custom development work to native Office features. And perhaps most importantly, it keeps end users in an environment that is comfortable and familiar (think native formatting and visualization of data in Excel® 2007). To see more information on the general area of OBAs, go online to msdn2.microsoft.com/aa905528. With the data source added to the SalesControlLibrary project, you can now design the component to search customer data. In the designer for my sales search form, I have added a number of Figure 5 Customer and Sales Data controls to the project including some labels, fields, a data grid that is connected to the Sales database, and some fields that display the customer contact information that corresponds to the selected item in the data grid. Figure 6 shows the completed form with all of the controls added. Note that while most of these controls are straightforward to add, with the data-grid view, you’ll need to first open the Data Sources pane, right-click the Sales data source and select Details, and then drag and drop the Sales records onto the data-grid view. Then right-click the control, select Edit Columns, and remove the SalesYear and SalesAmount, as you’re only interested in showing the CustomerID and SalesQuarter in the data-grid view. At this point, you’ve got the new controls added to your form and are ready to add some code to the controls. So, let’s Figure 6 Building the Customer Data User Control take a look at some of the key code that was added to this form. private SalesDataSetTableAdapters.SalesTableAdapter salesAdapter; The first things I’ll look at are the declarations that I’ve added to public event EventHandler the SalesSearch class. Specifically, I declared a table adapter for SalesDataChangeEvent; Company and Sales, and I created an event handler for any sales data changes: { namespace SalesControlLibrary { public partial class SalesSearch : UserControl { private SalesDataSetTableAdapters.CompaniesTableAdapter companiesAdapter; } The Customer Data Search Form The primary event being triggered is the executeSearch_click event that fires when the Search button is clicked. It’s found in the SalesSearch class, as you see in Figure 7. You can see that this creates a new instance of the companiesOffice Business Applications launch2008 57 http://msdn2.microsoft.com/aa905528
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.