<?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: Close() not supported in OnSwitchView?</title><link>https://www.infopathdev.com:443/forums/thread/27422.aspx</link><pubDate>Tue, 25 Mar 2008 19:24:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27422</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27422.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=27422</wfw:commentRss><description>&lt;p&gt;Happy to be able to offer the suggestions. I hope you are enjoying the learning process despite the deadlines.&lt;/p&gt;</description></item><item><title>Re: Close() not supported in OnSwitchView?</title><link>https://www.infopathdev.com:443/forums/thread/27416.aspx</link><pubDate>Tue, 25 Mar 2008 13:31:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27416</guid><dc:creator>AlphaCity7</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27416.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=27416</wfw:commentRss><description>&lt;p&gt;Hey Greg,&lt;/p&gt;
&lt;p&gt;I gave the OnContextChange a go but unfortunatly no luck. I ended up just putting a button to close the form, as you said not ideal, but it was&amp;nbsp;included strategically (if I may say so myself)&amp;nbsp;so that it adds to the astetics of the view.&lt;/p&gt;
&lt;p&gt;Trying these things out is a good way to learn about the programming side of things so I really appreciate your suggestions.&lt;/p&gt;</description></item><item><title>Re: Close() not supported in OnSwitchView?</title><link>https://www.infopathdev.com:443/forums/thread/27374.aspx</link><pubDate>Fri, 21 Mar 2008 17:15:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27374</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27374.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=27374</wfw:commentRss><description>&lt;p&gt;There are many things that cannot be done during a view switch -- including switching to another view during a view switch (i.e. redirecting the view switch elsewhere). Closing is also not likely available during that event.&lt;/p&gt;
&lt;p&gt;However you can place a button in the view (I know--not what you want to do--not automated enough) that the user can click in the new view, which will close the form.&lt;/p&gt;
&lt;p&gt;You can also look at the OnContextChange event and probably close in there. The context gets changed when a view is switched (unless, perhaps--I&amp;#39;m not sure--there is no controls in the view). Anyway, in this handler, you can check to see if the view name is &amp;quot;Email Submit&amp;quot; and if it is, then close the form). The context event is fired late enough that all your other processing should be completed first.&lt;/p&gt;
&lt;p&gt;Give it a try and let me know.&lt;/p&gt;</description></item><item><title>Close() not supported in OnSwitchView?</title><link>https://www.infopathdev.com:443/forums/thread/27369.aspx</link><pubDate>Fri, 21 Mar 2008 14:47:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27369</guid><dc:creator>AlphaCity7</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27369.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=27369</wfw:commentRss><description>&lt;p&gt;Hey everyone,&lt;/p&gt;
&lt;p&gt;I am performing an action&amp;nbsp;in jscript&amp;nbsp;everytime a certain view is chosen. So in the OnSwitchView I have placed an if statement as follows;&lt;/p&gt;
&lt;p&gt;if (XDocument.View.Name == &amp;quot;Email Submit&amp;quot;) &lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Perform action&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;My problem is I have tried placing a close() method in this if statement once the action has been completed. However, I always get an error! The code I use for the close is;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;XDocument.View.Window.Close(true);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I know the coding for the if statement and close method are&amp;nbsp;correct when used separately, so my question is can a close method not be put into an OnSwitchView event handler?&lt;/p&gt;
&lt;p&gt;I&amp;#39;m predicting the answer to this post is going to be a quick and painfull &amp;#39;no&amp;#39;.&lt;/p&gt;</description></item></channel></rss>