<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Strange problem</title><link>https://www.infopathdev.com:443/forums/thread/2793.aspx</link><pubDate>Tue, 18 Jul 2006 17:22:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:2793</guid><dc:creator>garym</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/2793.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=2793</wfw:commentRss><description>Matt,&lt;br /&gt;&lt;br /&gt;Thanks, that worked.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote id="quote"&gt;&lt;font size="1" face="Verdana, Arial, Helvetica" id="quote"&gt;quote:&lt;hr height="1" noshade id="quote"&gt;&lt;i&gt;Originally posted by Matt Faus&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;I believe you have fallen victim to event bubbling. There are a couple of options here, but what is happening is that the OnValidate event is being called for several nodes through a hierachy.  Instead of using e.Source, I suggest using e.Site, and on top of that you should probably put a limiting check on there to make sure you don't get that error:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Dim ppString As String&lt;br /&gt;ppString = e.Site.nodeValue.ToString()&lt;br /&gt;&lt;br /&gt;if( ppString.Length &amp;lt; 12 ) 'Make sure that the string is long enough&lt;br /&gt;     return;&lt;br /&gt;&lt;br /&gt;Dim ppStart As String&lt;br /&gt;Dim ppEnd As String&lt;br /&gt;Dim ppYear As String&lt;br /&gt;Dim ppMonth As String&lt;br /&gt;Dim ppDay As String&lt;br /&gt;Dim ppDateString As String&lt;br /&gt;&lt;br /&gt;MessageBox.Show("Date=" + ppString, "Timesheet", MessageBoxButtons.OK)&lt;br /&gt;ppYear = ppString.Substring(0, 4)&lt;br /&gt;&lt;br /&gt;(Sorry about the syntax on the code I edited, I don't really do VB)&lt;br /&gt;&lt;br /&gt;For more information about event bubbling, see this link:&lt;a target="_blank" href=http://www.infopathdev.com/howto/tutorials/default.aspx?i=3551199a23ac41f3a155b3a2ffc412c5&gt;http://www.infopathdev.com/howto/tutorials/default.aspx?i=3551199a23ac41f3a155b3a2ffc412c5&lt;/a&gt;&lt;br /&gt;&lt;hr height="1" noshade id="quote"&gt;&lt;/font id="quote"&gt;&lt;/blockquote id="quote"&gt;</description></item><item><title>Re: Strange problem</title><link>https://www.infopathdev.com:443/forums/thread/2792.aspx</link><pubDate>Tue, 18 Jul 2006 16:07:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:2792</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/2792.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=2792</wfw:commentRss><description>I believe you have fallen victim to event bubbling. There are a couple of options here, but what is happening is that the OnValidate event is being called for several nodes through a hierachy.  Instead of using e.Source, I suggest using e.Site, and on top of that you should probably put a limiting check on there to make sure you don't get that error:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Dim ppString As String&lt;br /&gt;ppString = e.Site.nodeValue.ToString()&lt;br /&gt;&lt;br /&gt;if( ppString.Length &amp;lt; 12 ) 'Make sure that the string is long enough&lt;br /&gt;     return;&lt;br /&gt;&lt;br /&gt;Dim ppStart As String&lt;br /&gt;Dim ppEnd As String&lt;br /&gt;Dim ppYear As String&lt;br /&gt;Dim ppMonth As String&lt;br /&gt;Dim ppDay As String&lt;br /&gt;Dim ppDateString As String&lt;br /&gt;&lt;br /&gt;MessageBox.Show("Date=" + ppString, "Timesheet", MessageBoxButtons.OK)&lt;br /&gt;ppYear = ppString.Substring(0, 4)&lt;br /&gt;&lt;br /&gt;(Sorry about the syntax on the code I edited, I don't really do VB)&lt;br /&gt;&lt;br /&gt;For more information about event bubbling, see this link:&lt;a target="_blank" href=http://www.infopathdev.com/howto/tutorials/default.aspx?i=3551199a23ac41f3a155b3a2ffc412c5&gt;http://www.infopathdev.com/howto/tutorials/default.aspx?i=3551199a23ac41f3a155b3a2ffc412c5&lt;/a&gt;</description></item><item><title>Strange problem</title><link>https://www.infopathdev.com:443/forums/thread/1423.aspx</link><pubDate>Mon, 17 Jul 2006 15:17:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:1423</guid><dc:creator>garym</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/1423.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=1423</wfw:commentRss><description>When executing the following code...&lt;br /&gt;&lt;br /&gt;&amp;lt;InfoPathEventHandler(MatchPath:="/dfs:myFields/dfs:dataFields/d:tblTimeSheet/@Date", EventType:=InfoPathEventType.OnValidate)&amp;gt; _&lt;br /&gt;        Public Sub tblTimeSheet_Date_attr_OnValidate(ByVal e As DataDOMEvent)&lt;br /&gt;&lt;br /&gt;            Dim ppStart As String&lt;br /&gt;            Dim ppEnd As String&lt;br /&gt;            Dim ppString As String&lt;br /&gt;            Dim ppYear As String&lt;br /&gt;            Dim ppMonth As String&lt;br /&gt;            Dim ppDay As String&lt;br /&gt;            Dim ppDateString As String&lt;br /&gt;&lt;br /&gt;            ppString = e.Source.nodeValue.ToString()&lt;br /&gt;            MessageBox.Show("Date=" + ppString, "Timesheet", MessageBoxButtons.OK)&lt;br /&gt;            ppYear = ppString.Substring(0, 4)&lt;br /&gt;&lt;br /&gt;I recveive the following error....&lt;br /&gt;&lt;br /&gt;System.ArgumentOutOfRangeException&lt;br /&gt;Index and length must refer to a location within the string.&lt;br /&gt;Parameter name: length&lt;br /&gt;   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)&lt;br /&gt;   at System.String.Substring(Int32 startIndex, Int32 length)&lt;br /&gt;   at TimeSheet.TimeSheet.tblTimeSheet_Date_attr_OnValidate(DataDOMEvent e) in C:\Documents and Settings\gmonk\My Documents\Visual Studio 2005\Projects\TimeSheet\CANProj1\FormCode.vb:line 99&lt;br /&gt;   at Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_SinkHelper.OnValidate(DataDOMEvent pDataDOMEvent)&lt;br /&gt;&lt;br /&gt;What happens is that the date string displays blank and then I receive the error message. After clicking ok the messagebox message displays again but with the date and the code continues normally.&lt;br /&gt;&lt;br /&gt;Any idea what is happening??&lt;br /&gt;&lt;br /&gt;Thanks,</description></item></channel></rss>