<?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>Workflow</title><link>https://www.infopathdev.com:443/forums/50.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Error on Initiation infopath 2007 form:System.InvalidOperationException: Invalid Context: &lt;XPath&gt; event must be registered before this form is deployed.</title><link>https://www.infopathdev.com:443/forums/thread/54605.aspx</link><pubDate>Thu, 06 May 2010 15:12:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:54605</guid><dc:creator>ManasPandey</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/54605.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=50&amp;PostID=54605</wfw:commentRss><description>It&amp;#39;s working for me. Publish the form after making the changes and deploy this published form.&lt;br /&gt;</description></item><item><title>Re: Error on Initiation infopath 2007 form:System.InvalidOperationException: Invalid Context: &lt;XPath&gt; event must be registered before this form is deployed.</title><link>https://www.infopathdev.com:443/forums/thread/54481.aspx</link><pubDate>Tue, 04 May 2010 06:56:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:54481</guid><dc:creator>ManasPandey</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/54481.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=50&amp;PostID=54481</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Rakesh, were you able to find the solution?&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Error on Initiation infopath 2007 form:System.InvalidOperationException: Invalid Context: &lt;XPath&gt; event must be registered before this form is deployed.</title><link>https://www.infopathdev.com:443/forums/thread/53132.aspx</link><pubDate>Fri, 26 Mar 2010 05:49:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:53132</guid><dc:creator>Rakesh Ranjan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/53132.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=50&amp;PostID=53132</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have developed a custom workflow using 32bit machin on VS 2008. It having a Initiation InfoPath form(developed on 64bit) with a textbox named &amp;#39;toolName&amp;#39;. I have added a event handler by right clicking on textBox and select &amp;quot;programming&amp;quot; then select &amp;quot;changed event&amp;quot;. VSTA opened and wrote the follwing code:&lt;/p&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;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; InternalStartup() {&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;EventManager.FormEvents.Loading += &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;LoadingEventHandler&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;(FormEvents_Loading);&lt;/p&gt;EventManager.XmlEvents[&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:myFields/my:toolName&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;].Changed += &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;XmlChangedEventHandler&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;(toolName_Changed);&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&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;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; toolName_Changed(&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; sender, &lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;XmlEventArgs&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; e)&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// XPathNavigator myNav = this.MainDataSource.CreateNavigator();&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// myNav.SelectSingleNode(&amp;quot;//my:keyword&amp;quot;, this.NamespaceManager).SetValue(&amp;quot;Keyword&amp;quot;);&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;I built this and deployed the workflow as feature along with infopath forms on the 64bit machine. When&amp;nbsp;I activate the workflow on the list item,&amp;nbsp;I always get the following error:&lt;/p&gt;
&lt;p&gt;System.InvalidOperationException, mscorlib &lt;br /&gt;&lt;br /&gt;System.InvalidOperationException: Invalid Context: /my:myFields/my:toolName event must be registered before this form is deployed. &lt;br /&gt;at Microsoft.Office.InfoPath.Server.SolutionLifetime.XmlEventsHost.get_Item(String xpath, String dataObjectName) &lt;br /&gt;at Microsoft.Office.InfoPath.Server.SolutionLifetime.XmlEventsHost.get_Item(String xpath) &lt;br /&gt;.......&lt;/p&gt;
&lt;p&gt;I think to register the event handler with the textbox is already done at the method &amp;quot;InternalStartup&amp;quot;. &lt;/p&gt;
&lt;p&gt;Please help me why&amp;nbsp;I am&amp;nbsp;getting this error? Is there another way to register the event on InfoPath form?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Rakesh&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>