<?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>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Exception has been thrown by the target of an invocation</title><link>https://www.infopathdev.com:443/forums/thread/20084.aspx</link><pubDate>Mon, 21 May 2007 14:09:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20084</guid><dc:creator>B.Shiva Prasad</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20084.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=20084</wfw:commentRss><description>&lt;p&gt;Hi edove,&lt;/p&gt;&lt;p&gt;By the way see this link, you will get some help&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.geekpedia.com/Question70_Exception-has-been-thrown-by-the-target-of-an-invocation.html"&gt;http://www.geekpedia.com/Question70_Exception-has-been-thrown-by-the-target-of-an-invocation.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;and for the second question, take the onAfterChange method for both date controls from there call the method &amp;quot;CalcDateDiff()&amp;quot; before that make a condition that if both date controls are not blank, so that the method calling time will reduce.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Hope this will help you.&lt;/p&gt;</description></item><item><title>Re: Exception has been thrown by the target of an invocation</title><link>https://www.infopathdev.com:443/forums/thread/20081.aspx</link><pubDate>Mon, 21 May 2007 13:20:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20081</guid><dc:creator>edove</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20081.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=20081</wfw:commentRss><description>By the way.. if I call this code from a button it works fine but I need the date diff to be updated every time one of the 2 dates is recalculated. Is there any other way to do this?</description></item><item><title>Exception has been thrown by the target of an invocation</title><link>https://www.infopathdev.com:443/forums/thread/20080.aspx</link><pubDate>Mon, 21 May 2007 13:11:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20080</guid><dc:creator>edove</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20080.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=20080</wfw:commentRss><description>Hi all,

Ok.. I am using xdExtension:CalcDateDiff() in a rule to call some code in my infopath form.&lt;p&gt;The code is as follows:&lt;/p&gt;&lt;p&gt;public void CalcDateDiff()
&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;XPathNavigator myNav = this.MainDataSource.CreateNavigator();

string dt1yr = myNav.SelectSingleNode(&amp;quot;/my:myFields/my:orderDates/my:contractExit&amp;quot;, this.NamespaceManager).Value.Substring(0, 4);
string dt1mth = myNav.SelectSingleNode(&amp;quot;/my:myFields/my:orderDates/my:contractExit&amp;quot;, this.NamespaceManager).Value.Substring(5, 2);
string dt1dy = myNav.SelectSingleNode(&amp;quot;/my:myFields/my:orderDates/my:contractExit&amp;quot;, this.NamespaceManager).Value.Substring(8, 2);

string dt2yr = myNav.SelectSingleNode(&amp;quot;/my:myFields/my:shipping/my:finalDateETD&amp;quot;, this.NamespaceManager).Value.Substring(0, 4);
string dt2mth = myNav.SelectSingleNode(&amp;quot;/my:myFields/my:shipping/my:finalDateETD&amp;quot;, this.NamespaceManager).Value.Substring(5, 2);
string dt2dy = myNav.SelectSingleNode(&amp;quot;/my:myFields/my:shipping/my:finalDateETD&amp;quot;, this.NamespaceManager).Value.Substring(8, 2);


DateTime firstDate = new DateTime(Convert.ToInt32(dt1yr), Convert.ToInt32(dt1mth), Convert.ToInt32(dt1dy));
DateTime secondDate = new DateTime(Convert.ToInt32(dt2yr), Convert.ToInt32(dt2mth), Convert.ToInt32(dt2dy));
TimeSpan diff = secondDate.Subtract(firstDate);
//MessageBox.Show(Convert.ToString(diff.Days));
myNav.SelectSingleNode(&amp;quot;/my:myFields/my:shipping/my:etdDiff&amp;quot;, this.NamespaceManager).SetValue(Convert.ToString(diff.Days));&lt;/p&gt;&lt;p&gt;}

&lt;/p&gt;&lt;p&gt;When I preview the form and activate the code I get this error message:
&amp;quot;Exception has been thrown by the target of an invocation&amp;quot;.. any ideas what that means??&lt;/p&gt;</description></item></channel></rss>