<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Using C# and I get an error 'Infopath cannot open the selected form'</title><link>https://www.infopathdev.com:443/forums/thread/53322.aspx</link><pubDate>Thu, 01 Apr 2010 20:10:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:53322</guid><dc:creator>putnamsam</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/53322.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=53322</wfw:commentRss><description>&lt;p&gt;So it looks like I get an error anytime I use code in a form.&amp;nbsp; I created a form and added a button and added code behind the button for a clicked event.&lt;/p&gt;Code:&lt;font size="2"&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Public&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Sub&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; CTRL1_5_Clicked(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;ByVal&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; sender &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Object&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;ByVal&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; e &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ClickedEventArgs)&lt;/p&gt;MessageBox.Show(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;Hello World&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;End&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Sub&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;And then when trying to preview I get the error &amp;#39;Infopath cannot open the selected form&amp;#39;.&amp;nbsp; I&amp;#39;ve tried messing with the trust settings and deleting the cache with no luck&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Using C# and I get an error 'Infopath cannot open the selected form'</title><link>https://www.infopathdev.com:443/forums/thread/53305.aspx</link><pubDate>Thu, 01 Apr 2010 17:49:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:53305</guid><dc:creator>putnamsam</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/53305.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=53305</wfw:commentRss><description>&lt;p&gt;Here is the situation:&lt;/p&gt;
&lt;p&gt;I am trying to code a form to access data from our AD.&amp;nbsp; I enabled the form for Full Trust, placed the form code in place and it will build without errors.&amp;nbsp; When the form trys to open (preview) I get the error.&amp;nbsp;Whe I try to open the form from the template I get this error:&lt;/p&gt;
&lt;p&gt;Form template: &lt;a&gt;file:///REMOVEDFILEPATHFORTHISTHREAD.xsn&lt;/a&gt;&lt;br /&gt;InfoPath cannot open the selected form because of an error in the form&amp;#39;s code.&lt;br /&gt;System.Security.SecurityException, mscorlib&lt;/p&gt;
&lt;p&gt;System.Security.SecurityException: Request for the permission of type &amp;#39;Microsoft.Office.InfoPath.InfoPathPermission, Microsoft.Office.InfoPath.Client.Internal.Host, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&amp;#39; failed.&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Office.InfoPath.XmlFormHostItem.Microsoft.VisualStudio.Tools.Applications.Contract.IEntryPointContract.Initialize()&lt;br /&gt;&amp;nbsp;&amp;nbsp; at Microsoft.VisualStudio.Tools.Applications.EntryPointAdapter.Microsoft.VisualStudio.Tools.Applications.Contract.IEntryPointContract.Initialize()&lt;br /&gt;The action that failed was:&lt;br /&gt;Demand&lt;br /&gt;The type of the first permission that failed was:&lt;br /&gt;Microsoft.Office.InfoPath.InfoPathPermission&lt;br /&gt;The Zone of the assembly that failed was:&lt;br /&gt;MyComputer&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My question:&amp;nbsp; Is this a trust issue with the form?&amp;nbsp; I can&amp;#39;t even preview it so it&amp;#39;s got me confused&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>