Cannot get to code-behind file - InfoPath Dev
in

InfoPath Dev

Cannot get to code-behind file

Last post 01-08-2009 04:00 PM by Jimmy. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 01-07-2009 09:35 AM

    • clawrence
    • Top 500 Contributor
    • Joined on 11-07-2008
    • Birmingham, AL
    • Posts 38

    Cannot get to code-behind file

    I'm working with a form, and I want to add custom code to it, but can't get to the code-behind files.

    I keep getting the following error:

    "InfoPath cannot add the even 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."

    Anyone else running into this or know of a solution?  I can't find much out there...

    Thanks!

  • 01-07-2009 09:41 AM In reply to

    Re: Cannot get to code-behind file

    In Tools -> Form Options -> Programming, there is an option to specify the project location for managed code.  If you change it to a directory to which you know you have write access, does that help?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-07-2009 09:43 AM In reply to

    Re: Cannot get to code-behind file

    Does this form template already have code? That is, did you start it from scratch, or are you modifying a template someone else developed?

    You can find out where the template thinks its code is by going to Tools/Form Options and selecting the Programming tab. There will be a path to where it expects to see its code files (if they already exist). There is also a button you can click to remove existing code (disclaimer, this does exactly what it says, so if the form template contains compiled code already, it will be removed). If you have the source code files, you can also repoint the template in this window by browsing to the correct files.

    You can also save your template as source files and look for a .dll in the source files to see if there is any managed code in the template.

    Hilary Stoupa

  • 01-07-2009 09:52 AM In reply to

    • clawrence
    • Top 500 Contributor
    • Joined on 11-07-2008
    • Birmingham, AL
    • Posts 38

    Re: Cannot get to code-behind file

    I've never put code with this form template.  I did save the source files, just to double check, and no .dll.

    I have write access to the drive where I'm trying to put the code.

    If I start a new, blank form, I have no problem getting to the code-behind files.  But I don't want to have to rebuild this form from scratch - I've been working on it for months.

  • 01-07-2009 10:02 AM In reply to

    • clawrence
    • Top 500 Contributor
    • Joined on 11-07-2008
    • Birmingham, AL
    • Posts 38

    Re: Cannot get to code-behind file

    I went to all the options, and changed my code language from VB to C#.  It allowed me to get the code that way.

     I then removed the code, and switched everything back to VB - still works.

     I guess I'm good to go.

  • 01-07-2009 10:02 AM In reply to

    Re: Cannot get to code-behind file

    I found this which suggests that either the path to the proposed code file location could be too long, or the name of the form could cause a conflict. Perhaps try redirecting the location for the code to a nice short path, or doing a Save As and saving your form with a new name?

    Hilary Stoupa

  • 01-08-2009 06:53 AM In reply to

    • jbdement
    • Not Ranked
      Female
    • Joined on 01-08-2009
    • Great state of Tennessee
    • Posts 8

    Re: Cannot get to code-behind file

    Hello and help! I did not intend to add code to my form.  However, even if you simply open anything under the Tools/Programming, InfoPath adds code.  I've gone back to Tools/Form Options/Programming and "removed" code but it still seems to be there.  How can I get back to my original form without code?  I really really hate to have to redo the form.  Thanks! Julie

  • 01-08-2009 10:14 AM In reply to

    Re: Cannot get to code-behind file

    Tools/Form Options/Programming/Remove Code should be all you need to do to eliminate the code from your form.  What is it that's indicating that there is still code in your form?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-08-2009 12:56 PM In reply to

    • jbdement
    • Not Ranked
      Female
    • Joined on 01-08-2009
    • Great state of Tennessee
    • Posts 8

    Re: Cannot get to code-behind file

    Yes, you would think it would be so easy.  However, when any other user tries to open the form on my SharePoint site (which they have full access too).  Here is the message they get:   I hope you can see it.  It isn't a domain permissions problem because user "were" able to open it prior to my opening the programming page in IP

     

  • 01-08-2009 04:00 PM In reply to

    Re: Cannot get to code-behind file

    I'm afraid I can't see any message there.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.