Welcome Guest!
Create Account | Login
Locator+ Code:

Search:
FTPOnline Channels Conferences Resources Hot Topics Partner Sites Magazines About FTP RSS 2.0 Feed

Free Trial Issue of Visual Studio Magazine

email article
printer friendly
get the code
more resources

Use InfoPath With VS.NET 2003
Now you can implement business logic behind InfoPath forms with managed VB.NET or C# code instead of JScript or VBScript event handlers.
by Roger Jennings

Posted March 1, 2004

Technology Toolbox: VB.NET, C#, XML, InfoPath 2003 Service Pack 1 (SP-1) Preview, InfoPath 2003 Toolkit for Visual Studio .NET, Visual Studio .NET 2003

ADVERTISEMENT

Many Microsoft service packs only fix bugs and plug security holes. Microsoft Office InfoPath 2003 Service Pack 1 (SP-1) is an exception—it includes a full-scale upgrade of Microsoft's innovative XML-based data gathering and structural editing application. InfoPath SP-1 adds more than a dozen new declarative form design and deployment features to InfoPath 1.0. You can download and install a preview of InfoPath 2003 SP-1 that's planned for release in late June 2004 (see Additional Resources). InfoPath SP-1 is a standalone version that doesn't require Office 2003 or the InfoPath 2003 release version. If you've installed InfoPath, you must remove it prior to running the SP-1 setup program.

Better yet, Microsoft has also released the Microsoft Office InfoPath 2003 Toolkit for Visual Studio .NET. Add this to SP-1, and you get the most significant new feature for Visual Studio developers: support for Visual Studio .NET 2003 and .NET Framework 1.1. InfoPath SP-1 now becomes the third Office System 2003 application to support VS.NET 2003 and .NET Framework 1.1 (see Additional Resources). The Toolkit lets form developers implement business logic behind InfoPath forms with managed VB.NET or C# code instead of JScript or VBScript event handlers.

I'll give you an overview of the Toolkit and show how it integrates with InfoPath SP-1's XML data sources. I'll also describe briefly InfoPath SP-1's other important form design and deployment features. You'll get the most out of this discussion if you have some experience with InfoPath 1.0's form design mode.

You start by downloading the 138 MB InfoPath 2003 SP-1 preview, removing your original release version of InfoPath (if it's installed), and running Ipprev.exe. Then download and install the Toolkit (Ipvsproj.exe), which requires VS.NET 2003. The Toolkit installation adds a Microsoft Office InfoPath Projects node to Visual Studio's New Project dialog. Visual Basic Projects and Visual C# Projects subnodes display an InfoPath Form Template icon. Perhaps you've installed the Microsoft Visual Studio Tools for the Microsoft Office System (VSTO). If so, you'll find that creating a new InfoPath project resembles starting a Word document or template, or an Excel workbook project.

Double-clicking on the InfoPath icon creates a default InfoPathProject1 and displays a Microsoft Office Project Wizard dialog. The dialog lets you either create a new form or copy an existing InfoPath 1.0 or 1.1 form template file (FormName.xsn or manifest.xsf) to the project. The wizard upgrades version 1.0 template copies automatically. Click on Finish to extract or copy the template files to the project folder. The wizard adds Imports, Namespace ProjectName and Public Class ProjectName elements to the FormCode.vb file automatically.

The _Startup event handler assigns the form's Application instance to the thisApplication variable and the XDocument. This is how the event handler informs XDocument of the current state of the form's data source. Press F5 to build and run the project. The process opens an InfoPath window in design mode and displays a form preview.




Back to top














Java Pro | Visual Studio Magazine | Windows Server System Magazine
.NET Magazine | Enterprise Architect | XML & Web Services Magazine
VSLive! | Thunder Lizard Events | Discussions | Newsletters | FTP Home