If you missed it on BizSupportOnline.NET, I’ve created 2 video presentations in which I show you step-by-step how to write code in InfoPath using Visual Studio Tools for Applications and how to write code in InfoPath using Visual Studio 2005.
Both tutorials demo the same scenario of setting the value of an InfoPath field by clicking on a button.
But before you can start writing code in InfoPath, you have to decide which programming language you want to use.
There are 4 programming languages in InfoPath:
- VBScript
- JScript
- Visual Basic (.NET)
- C# (.NET)
Which InfoPath programming language to choose?
VBScript and JScript are of limited use in InfoPath 2007, and are not supported in browser forms. So that leaves us with Visual Basic and C# as the better and more powerful languages to choose from.
C# tends to be a more popular language and is used by many more developers than Visual Basic. Therefore, it is much easier to find C# code snippets on the Internet than it is to find Visual Basic code snippets.
In the end, the programming language you choose, will depend largely on your programming skills and what you feel most comfortable programming in.
Visual Studio Tools for Applications vs. Visual Studio 2005
You can use either Visual Studio Tools for Applications (VSTA) or Visual Studio 2005 to write either Visual Basic or C# code in InfoPath 2007.
When choose one or the other tool? I’d say, go with VSTA at all times, unless you want to do advanced stuff such as attach the Visual Studio debugger to a process. You might need to do the latter for instance when you’re writing code in InfoPath forms that run in SharePoint, i.e., browser forms.
On the other hand, if you use Visual Studio on a regular basis and know in advance that you’ll be writing complex code in your InfoPath form template, it makes sense to go with Visual Studio as your preferred programming tool for InfoPath.
In any case, if you start out writing code in VSTA and halfway through you decide that you need to switch to writing code in Visual Studio 2005, it isn’t that difficult to import the InfoPath form template in Visual Studio 2005 and create a project for it.
VSTA is a cut-down version of Visual Studio. While you cannot do everything with it that you can do with Visual Studio, it can get you a far way. And an added benefit is that, unlike Visual Studio, you don’t have to purchase VSTA separately from InfoPath 2007, because it is included as an option in the InfoPath setup program.

Comments to this post were closed 30 days after it was published.