<?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>Views</title><link>https://www.infopathdev.com:443/forums/42.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Execute c# code on view switches</title><link>https://www.infopathdev.com:443/forums/thread/89863.aspx</link><pubDate>Thu, 16 May 2013 19:33:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89863</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89863.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=89863</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Maybe use a couple state variables? Set one to the default view so it is set correctly on load and then keep track of them from there? &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.xmlform.formstate.aspx"&gt;http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.xmlform.formstate.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Execute c# code on view switches</title><link>https://www.infopathdev.com:443/forums/thread/89848.aspx</link><pubDate>Thu, 16 May 2013 17:45:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89848</guid><dc:creator>Mystere60</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89848.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=89848</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi,&lt;/p&gt;&lt;p&gt;With infopath 2010, we can detect and execute code on each view switch.&lt;/p&gt;&lt;p&gt;Sample :&amp;nbsp;&lt;/p&gt;&lt;pre&gt;&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FormEvents_ViewSwitched(&lt;span style="color:Blue;"&gt;object&lt;/span&gt; sender, ViewSwitchedEventArgs e)
{
   MessageBox.Show(&lt;span style="color:#A31515;"&gt;&amp;quot;Loading the view: &amp;quot;&lt;/span&gt; + 
      &lt;span style="color:Blue;"&gt;this&lt;/span&gt;.CurrentView.ViewInfo.Name);
}&lt;/pre&gt;&lt;pre&gt;What I need is to execute the same code only when I leave specific views.&lt;/pre&gt;&lt;pre&gt;Is it possible to know which is the previous view ? (Something like PreviousView instead of CurrentView - and without using a hidden textbox defined in each view and  containing the name of the view ).&lt;/pre&gt;&lt;pre&gt;Thanks in advance ! &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;PS: sorry for my poor english  &lt;br /&gt;&lt;/pre&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>