Visual Studio Tools for Office: Using Visual Basic 2005 with Excel, Word, Outlook, and InfoPath
|
|
InfoPath is an Office application that enables users to design and fill out rich, XML-based forms. When designing a form, you can start with a blank form or infer the form structure from an XML data file, an XML schema file, a database, or even a Web service. Every form can be composed of one or more views. A view is what users see when they fill out the form. Each view consists of one or more controls that are data-bound to XML data nodes. A node is a field or group in the data source that represents an item of the XML data behind the form. You can add features such as conditional formatting, spell checking, and autocomplete to forms using the form's designer, but more complex forms might require custom code to achieve the desired results. You might write code behind a form to verify that an e-mail address is valid; to fetch a current stock quote from a Web service; or to restrict certain views to be available only to users with a particular role, such as an administrator. Before VSTO, code behind forms in InfoPath consisted solely of JScript and VBScript code developed with the Microsoft Script Editor. Although easy to use, the script languages lack some of the language features that make developing and maintaining larger, more complex customized forms easier, such as strong typing, IntelliSense, and access to the .NET framework. This chapter discusses how to use VSTO to create InfoPath forms with managed code behind them. The chapter starts with a brief overview of what must be installed on your machine to develop managed code behind an InfoPath form with VSTO and shows how Visual Studio and InfoPath work together. Then the chapter covers the InfoPath security model, deployment model, and event-driven programming model. We consider the data events that you can handle in your code. We also consider the InfoPath form object model and how to handle form-related events. |
|
|