Recently I have developed a DIP (Document Information Panel) for a SharePoint template using InfoPath, which is accessing the data from a SQL database. So I got a chance to play around with InfoPath and faced some issues with the trust level security and all, I will post the step by step details later. 🙂
Depend on our requirements we can choose the programming language in InfoPath, there are 4 different languages (According to my knowledge C#, VB.Net, JScript and VBScript) in InfoPath and there are some limitation/difficulties in scripting languages (debugging, not supported in browser forms and lack of resources), so we will stick with our familiar C# or VB.Net. We can use either Visual Studio Tools for Applications (VSTA) or Visual Studio, in this example I used VSTA.
Step 1: Open a InfoPath template which you want to set the programming language.
Step 2: For 2007: Go to Tools menu and select Form Options (Tools –> Form Options)
For 2010: Go to Developer tab menu and select Language button (Developer Menu –> Language)
Step 3: On the Form Options dialog box, select the programming on the list, then select the language in the Form template code language drop down list box and click Ok (Programming –> Form template code language)
Step 4: We are ready to rock 🙂 If you want to code in the Form loading event, just go to Tools –> Programming –> Loading Events..
Step 5: Happy Coding..!