Microsoft KB Archive/908017

= How to use the FormsFactory class to open Accounting Express 2007 forms, Accounting Professional 2007 forms, or Small Business Accounting forms =

Article ID: 908017

Article Last Modified on 2/7/2007

-

APPLIES TO


 * Microsoft Office Accounting Express 2007
 * Microsoft Office Accounting Professional 2007
 * Microsoft Office Small Business Accounting 2006
 * Microsoft Office Small Business Management Edition 2006
 * Microsoft Office Small Business Accounting 2006 Software Development Kit 1.2

-





INTRODUCTION
This article describes how to use the FormsFactory class to open certain Microsoft Office Accounting Express 2007 forms, Microsoft Office Accounting Professional 2007 forms, or Microsoft Office Small Business Accounting forms that are included in third-party applications.



MORE INFORMATION
You can open certain Accounting Express 2007 forms, Accounting Professional 2007 forms, or Small Business Accounting forms if the applications that include the forms run on a computer that has Accounting Express 2007, Accounting Professional 2007, or Small Business Accounting installed.

For example, assume that you want users to be able to add a customer dynamically, without re-creating the business logic that is contained in the Accounting Express 2007, Accounting Professional 2007, or Small Business Accounting customer form. In this case, you can use the FormsFactory class to open the Accounting Express 2007, Accounting Professional 2007, or Small Business Accounting customer form. This feature enables a user to add a customer and then return execution to the application.

The following code examples demonstrate two scenarios. In the first scenario, the FormsFactory class is used to open a blank customer form. This scenario is useful if a user must add a new customer. The second scenario opens the customer form and then loads a specific customer into the form. This scenario is useful when existing customer information must be edited.

Scenario 1
// Log on by using a company name and a server name of your choice. iSbi.LogOn(companyName, serverName);

// Declare the FormsFactory class. IFormsFactory iFF = (IFormsFactory) uiAssembly.CreateInstance(&quot;Microsoft.BusinessSolutions.SmallBusinessAccounting.UI.FormsFactory&quot;); iFF.Initialize(iSbi);

// Retrieve the customer form with an existing customer loaded. ICustomerAccount cust = (ICustomerAccount) iSbi.CustomerAccounts.GetByDataRow(iSbi.CustomerAccounts.DataView.Table.Rows[4]); System.Windows.Forms.Form sbaForm = iFF.CreateForm(cust); sbaForm.StartPosition = FormStartPosition.CenterScreen; sbaForm.ShowDialog;

Scenario 2
// Log on by using a company name and a server name of your choice. iSbi.LogOn(companyName, serverName);

// Declare the FormsFactory class. IFormsFactory iFF = (IFormsFactory) uiAssembly.CreateInstance(&quot;Microsoft.BusinessSolutions.SmallBusinessAccounting.UI.FormsFactory&quot;); iFF.Initialize(iSbi);

// Retrieve the customer form with an existing customer loaded. ICustomerAccount cust = iSbi.CreateCustomerAccount; System.Windows.Forms.Form sbaForm = iFF.CreateForm(cust); sbaForm.StartPosition = FormStartPosition.CenterScreen; sbaForm.ShowDialog;

Additional query words: Content Maintenance 45421, SBA, SDK

Keywords: kbhowto kbmbsmigrate KB908017

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.