Hi,
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 'toolName'. I have added a event handler by right clicking on textBox and select "programming" then select "changed event". VSTA opened and wrote the follwing code:
public void InternalStartup() {
EventManager.FormEvents.Loading +=
new LoadingEventHandler(FormEvents_Loading);EventManager.XmlEvents["/my:myFields/my:toolName"].Changed += new XmlChangedEventHandler(toolName_Changed);
}
public void toolName_Changed(object sender, XmlEventArgs e)
{
// XPathNavigator myNav = this.MainDataSource.CreateNavigator();
// myNav.SelectSingleNode("//my:keyword", this.NamespaceManager).SetValue("Keyword");
}
I built this and deployed the workflow as feature along with infopath forms on the 64bit machine. When I activate the workflow on the list item, I always get the following error:
System.InvalidOperationException, mscorlib
System.InvalidOperationException: Invalid Context: /my:myFields/my:toolName event must be registered before this form is deployed.
at Microsoft.Office.InfoPath.Server.SolutionLifetime.XmlEventsHost.get_Item(String xpath, String dataObjectName)
at Microsoft.Office.InfoPath.Server.SolutionLifetime.XmlEventsHost.get_Item(String xpath)
.......
I think to register the event handler with the textbox is already done at the method "InternalStartup".
Please help me why I am getting this error? Is there another way to register the event on InfoPath form?
Regards,
Rakesh