Tuesday, December 04, 2007

Infopath cannot add the event handler

While working in Infopath 2007 managed code when i tried to attach managed code to existing
form i got the following error:

Error :

Infopath cannot add the event handler

Infopath cannot create the visual basic or C# project

The location for the visual basic or C# project cannot be found or cannot be accessed


So next steps is to search internet , well no luck in that too . Then i decided to try different things with my form settings and shazam!!! got the form working .

Solution in my case :
  • Go to Tools -> Options ->Design Tab
  • Check the language for programming /select the desired language
  • Go to Tools -> Form Options -> Programming Section
  • Select the programming language which you selected in previous settings

That should be good enough to make you go forward.

In my case there was difference in language settings which caused all these errors, which might be in your case too.

Happy Infopath Programming!!!!

11 comments:

Anonymous said...

thanks man, it works

Anonymous said...

This is really crap by microsoft. why the hell they have givem this option. Defect in Infopath.
Thanks a ton this helped me

EnoNomi said...

Thanks, you got me most of the way there. I just needed to add a couple more steps by making the path local to my PC (it was going to a shared location) and saving a copy of the .xsn to the same location.

Anonymous said...

Your post just saved me a ton of time searching for a solution. THANK YOU, THANK YOU!

Anonymous said...

Thanks, this saved me a lot of time!

Anonymous said...

Thanks a ton!

Rae said...

I know this post is three years old but believe me - I have been searching for a solution to this exact problem all day and this post has finally resolved my issue. I tried everything else (and I believe I did try changing these settings but I must not have done it in this exact order) and NOTHING was working. Thanks so much!!

Anonymous said...

Hate to say it, but im having same problem and this didnt fix the problem.

Anonymous said...

What I did is on that original error screen, I hit the browse button, then browsed into the project again and pointed it at the .csproj file. It was different because this was a project which I moved from another developer's machine onto mine, so obviously the path to the code project was different. Ridiculous that InfoPath can't look in the root folder of the project for this??

Thanks for this post, very helpful!

MacedonKing said...

Thanks for taking the time for the post.. saved me a lot of time!

JJ said...

Thanks Mate. It did help me.