Form Events, Properties, and Methods
Conclusion
This chapter introduced InfoPath development with VSTO. You learned how to create a new VSTO InfoPath project based on a new form or an existing form. The chapter also covered key objects that you will code against, including InfoPath's Application object, the XDocument object (which represents a form), the View object, and objects passed as parameters to events such as the DataDOMEvent object.
This chapter also examined the InfoPath security model. You learned how a form is granted a particular security level, such as restricted, domain, or full trust. The chapter also covered InfoPath's data model and key data events such as OnBeforeChange, OnValidate, and OnAfterChange. You also read about the InfoPath's form object model and how to handle key events, including OnLoad, a button click handler, OnContextChange, and OnSubmitRequest.
As you have no doubt discovered while working through the examples in this chapter, InfoPath development differs quite a bit from the Excel, Word, and Outlook development experience. Whenever you add an event handler, you must do so using the menus and commands in InfoPathyou never use Visual Studio to add an event handler. Event handlers do not follow the traditional .NET event model of declaring new delegates and adding them to an event source using the += syntax of C#. Instead, methods that will handle InfoPath events are attributed. These attributes are somewhat difficult to create and edithence the need to have the InfoPath menus and dialogs generate these handlers for you. Finally, InfoPath development differs from Excel and Outlook because the "design view" of an InfoPath form is the InfoPath application window, not a designer that shows up in place within Visual Studio.
This book does not cover InfoPath in any additional detail. For more information on InfoPath programming, consult the MSDN page for InfoPath at http://msdn.microsoft.com/library/en-us/odc_2003_ta/html/odc_ancInfo.asp.