Everything SharePoint and XAML

My continuous learning of SharePoint, XAML, Silverlight, Windows Phone 7, Windows 8, Office, VSTO, C#…

Remove Existing InfoPath VSTA Project

Posted by Steve Pietrek on April 15, 2008

This morning I was creating an InfoPath 2007 form and wanted to add an OnChanged event handler for a dropdownlist control. Bear in mind this is my first foray into InfoPath programming – never had a need previously. I right-clicked the dropdownlist control and selected Programming – Changed Event. Visual Studio Tools for Applications fired up but the project was VB.NET. No offense to VB but I would rather program in C#. Need to find a way to remove the current VB project and create a C# one instead.

The first task was to ensure all new form projects would default as C# projects. To change the default:

  1. Open Tools – Options
  2. Click the Design tab
  3. For the “Programming language when designing forms that run in InfoPath” option, select C#.
  4. For the “Programming language when designing for InfoPath and InfoPath Forms Services” option, select C#.
  5. If needed, you can also change the default project location – possibly to help with version control.
  6. Click the OK button to save.

Now that all new forms will default to C#, I need to find a way to remove the current project. Thinking I could solve the issue by cutting off the head, I deleted the project in the C:\Documents and Settings\Administrator\My Documents\InfoPath Projects\ExpenseReport\ folder. Unfortunately, after deleting the directory, when I accessed the “Changed Event” event, I received the following error:

“InfoPath cannot add the event handler”

InfoPath cannot add the event handler.

After some digging, to remove InfoPath code, or specifically in my case, unhook the project:

  1. Open Tools – Form Options
  2. Select the Programming category
  3. Click the Remove button and select Yes
  4. Click OK

Remove Attached InfoPath VSTA Project

Advertisements

One Response to “Remove Existing InfoPath VSTA Project”

  1. Andy said

    Thanks for this nugget of advice – I did *exactly* the same as you during my first attempt at an Infopath form!

Sorry, the comment form is closed at this time.

 
%d bloggers like this: