How to set the programming language in InfoPath 2007
Learn how you can set the programming language in InfoPath for both the current and all future InfoPath form templates you create.
In a recent post, I outlined your options when choosing a programming language for writing code in InfoPath.
If you’re using Visual Studio Tools for Applications (VSTA) to write code in InfoPath 2007, it is good to know that you can set the programming language for your InfoPath form template in one of two ways:
- You can set the default programming language, which will be set for all new InfoPath form templates you create in the future.
- You can set the programming language for the current InfoPath form template you’re working on.
Of course, if you set the default programming language, you can always override it by setting the programming language for the current InfoPath form template you’re working on.
Set the default programming language for InfoPath
To set the default programming language to be used for all future InfoPath form templates:
- On the Tools menu, click Options.
- On the Options dialog box, click the Design tab.
- On the Design tab, select the desired language in the Programming language when designing forms that run in InfoPath and the Programming language when designing for InfoPath and InfoPath Forms Services drop-down list boxes.
Set the programming language for the current form template
To set the programming language for the InfoPath form template that you’re currently working on:
- On the Tools menu, click Form Options.
- On the Form Options dialog box, select the Programming category in the left list, and then select the desired language in the Form template code language drop-down list box.
Remove existing code from an InfoPath form template
If you want to remove all code that you’ve added to an InfoPath form template:
- On the Tools menu, click Form Options.
- On the Form Options dialog box, select the Programming category in the left list.
- Click the Remove Code button behind the Form template code language drop-down list box.
Change the programming language for an InfoPath form template
If you accidentally start programming in one language (e.g. Visual Basic) and want to switch to programming in a different language (e.g. C#), you’ll have to:
- Remove the code from the form template.
- Change the form template language via the Form Options dialog box.
Warning:
Changing the programming language of an InfoPath form template does not mean that InfoPath will automatically translate all of your code from one language to another. If you change the language, you’ll lose the code you’ve currently written. So make sure you copy your code before you change the language, so that you can translate the code yourself after you’ve set the new language.
Tip:
A good practice after you’ve installed InfoPath is to immediately set the default programming language for InfoPath, so that any future InfoPath form templates you create and write code for will automatically use this language.
Related Posts
Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of S.Y.M. Wong-A-Ton. Usage of techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author, S.Y.M. Wong-A-Ton.


