<?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>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: How to close a form with a changed event?</title><link>https://www.infopathdev.com:443/forums/thread/31789.aspx</link><pubDate>Thu, 28 Aug 2008 15:23:11 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31789</guid><dc:creator>davidlozzi</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31789.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=31789</wfw:commentRss><description>&lt;p&gt;So, I&amp;#39;m having the same need, and I think i found a work around. The&amp;nbsp;save&amp;nbsp;button that submits my form has&amp;nbsp;code and a&amp;nbsp;rule as well that closes the form. So the form code runs first, then the rules are applied. So on click, the code runs, does some logic then submits it, then the rules run and closes the form.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The issue with this is that if there is an error on the submit, the form still closes and now i&amp;#39;m out of luck. What I did to remedy this was add a hidden field called closeForm, and set the condition of the rule in the save button to check if the closeForm field is not blank, then close the form. By default, this text box will be blank. I set a value in this text box after the submit completes successfully, so the form should only close upon a successful submittal. &lt;/p&gt;
&lt;p&gt;I then handle the error and let the end user know. Works pretty darn well!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: How to close a form with a changed event?</title><link>https://www.infopathdev.com:443/forums/thread/31117.aspx</link><pubDate>Fri, 01 Aug 2008 14:40:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31117</guid><dc:creator>andyoye</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31117.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=31117</wfw:commentRss><description>&lt;p&gt;My form is web based and this.close is not available in VSTA as its compatibility is set to IPFS. any other method to close the form? Thanks &amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: How to close a form with a changed event?</title><link>https://www.infopathdev.com:443/forums/thread/30664.aspx</link><pubDate>Tue, 22 Jul 2008 09:38:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:30664</guid><dc:creator>srikrushna</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/30664.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=30664</wfw:commentRss><description>Hope this works for you

this.Close();</description></item><item><title>Re: How to close a form with a changed event?</title><link>https://www.infopathdev.com:443/forums/thread/30609.aspx</link><pubDate>Mon, 21 Jul 2008 07:37:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:30609</guid><dc:creator>ddregs</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/30609.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=30609</wfw:commentRss><description>&lt;p&gt;Thanks Shiva for the tip.&lt;/p&gt;&lt;p&gt;Unfortunately I couldn&amp;#39;t find any ReturnStatus properties for the object e, neither in the changed event nor in the submit event.&lt;/p&gt;&lt;p&gt;Could you please advice me where to insert that code line?&lt;/p&gt;&lt;p&gt;Thanks&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: How to close a form with a changed event?</title><link>https://www.infopathdev.com:443/forums/thread/30531.aspx</link><pubDate>Thu, 17 Jul 2008 14:01:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:30531</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/30531.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=30531</wfw:commentRss><description>&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;LINE-HEIGHT:150%;"&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:150%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;Hello,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:150%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:150%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;You have to use the below code for close the form.&lt;/span&gt;&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:150%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:150%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;e.ReturnStatus = false&lt;/span&gt; 
&lt;p&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:150%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:150%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:150%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:150%;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;Otherwise you can close the form from taskpane.&lt;/span&gt; 
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>How to close a form with a changed event?</title><link>https://www.infopathdev.com:443/forums/thread/30485.aspx</link><pubDate>Wed, 16 Jul 2008 08:41:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:30485</guid><dc:creator>ddregs</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/30485.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=30485</wfw:commentRss><description>&lt;p&gt;Hi all,&lt;/p&gt;&lt;p&gt;I wrote some code behind a combo-box, in the changed event, where I check the existance of a saved xml and load it if found. I&amp;#39;d like to close the current window , to leave only the found file open.&lt;/p&gt;&lt;p&gt;I tried submitting the active window and in the submit code I used the Application.ActiveWindow.Close(true). But it still doesn&amp;#39;t work giving the usual&lt;/p&gt;&lt;p&gt;System.Runtime.InteropServices.COMException&lt;br /&gt;Invalid context for OM call.&lt;br /&gt;at Microsoft.Office.Interop.InfoPath.SemiTrust.Window.Close(Boolean fForce)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Office.Interop.InfoPath.SemiTrust.WindowObjectWrapper.Close(Boolean fForce)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Office.InfoPath.Internal.WindowHost.Close(Boolean force)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at PRil.FormCode.FormEvents_Submit(Object sender, SubmitEventArgs e)&lt;/p&gt;&lt;p&gt;I know I cannot execute the Window.Close method at the changed method, but this time I am triggering the submit (via code) and expected it to be run.&lt;/p&gt;&lt;p&gt;Any suggestions? Thanks in advance for your help.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>