Using C# and I get an error 'Infopath cannot open the selected form' - InfoPath Dev
in

InfoPath Dev

Using C# and I get an error 'Infopath cannot open the selected form'

Last post 04-01-2010 01:10 PM by putnamsam. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-01-2010 10:49 AM

    Using C# and I get an error 'Infopath cannot open the selected form'

    Here is the situation:

    I am trying to code a form to access data from our AD.  I enabled the form for Full Trust, placed the form code in place and it will build without errors.  When the form trys to open (preview) I get the error. Whe I try to open the form from the template I get this error:

    Form template: file:///REMOVEDFILEPATHFORTHISTHREAD.xsn
    InfoPath cannot open the selected form because of an error in the form's code.
    System.Security.SecurityException, mscorlib

    System.Security.SecurityException: Request for the permission of type 'Microsoft.Office.InfoPath.InfoPathPermission, Microsoft.Office.InfoPath.Client.Internal.Host, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.
       at System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
       at Microsoft.Office.InfoPath.XmlFormHostItem.Microsoft.VisualStudio.Tools.Applications.Contract.IEntryPointContract.Initialize()
       at Microsoft.VisualStudio.Tools.Applications.EntryPointAdapter.Microsoft.VisualStudio.Tools.Applications.Contract.IEntryPointContract.Initialize()
    The action that failed was:
    Demand
    The type of the first permission that failed was:
    Microsoft.Office.InfoPath.InfoPathPermission
    The Zone of the assembly that failed was:
    MyComputer

     

    My question:  Is this a trust issue with the form?  I can't even preview it so it's got me confused

  • 04-01-2010 01:10 PM In reply to

    Re: Using C# and I get an error 'Infopath cannot open the selected form'

    So it looks like I get an error anytime I use code in a form.  I created a form and added a button and added code behind the button for a clicked event.

    Code:

    Public Sub CTRL1_5_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)

    MessageBox.Show("Hello World")

    End Sub

    And then when trying to preview I get the error 'Infopath cannot open the selected form'.  I've tried messing with the trust settings and deleting the cache with no luck

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.