<?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>Browser Forms</title><link>https://www.infopathdev.com:443/forums/40.aspx</link><description>For browser form specific questions</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: XPathNavigator = this.CreateNavigator(); //-&gt; System.IndexOutOfRangeException: Index was outside the bounds of the array.</title><link>https://www.infopathdev.com:443/forums/thread/50043.aspx</link><pubDate>Fri, 18 Dec 2009 10:00:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:50043</guid><dc:creator>ACrush</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/50043.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=50043</wfw:commentRss><description>&lt;p&gt;This works:&lt;/p&gt;&lt;font size="2"&gt;&lt;code&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; login = i.Current.SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;my:AccountId&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager)&lt;br /&gt;.Value&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;/*.Split(&amp;#39;\\&amp;#39;)[1]*/&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;; &lt;br /&gt;login = login.Substring(login.IndexOf(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;#39;\\&amp;#39;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)+1); &lt;br /&gt;n.SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:FormRoot/my:RecepientsList&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).SetValue( login ); &lt;/font&gt;&lt;/code&gt;&lt;/font&gt;</description></item><item><title>Re: XPathNavigator = this.CreateNavigator(); //-&gt; System.IndexOutOfRangeException: Index was outside the bounds of the array.</title><link>https://www.infopathdev.com:443/forums/thread/50042.aspx</link><pubDate>Fri, 18 Dec 2009 09:50:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:50042</guid><dc:creator>ACrush</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/50042.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=50042</wfw:commentRss><description>&lt;p&gt;I have found that the culprit is in the &lt;font color="blue"&gt;string.Split(char)&lt;/font&gt; method. The exception is thrown (but doesn&amp;#39;t cancel the actual splitting) if you uncomment the Split part in the following simple sequence:&lt;/p&gt;&lt;code&gt;string login = i.Current.SelectSingleNode(&amp;quot;my:AccountId&amp;quot;, NamespaceManager).Value&lt;font color="green"&gt;/*.Split(&amp;#39;\\&amp;#39;)[1]*/&lt;/font&gt;; &lt;br /&gt;n.SelectSingleNode(&amp;quot;/my:FormRoot/my:RecepientsList&amp;quot;, NamespaceManager).SetValue(login); &lt;/code&gt;</description></item><item><title>string.Split(char)[int] in browser causes System.IndexOutOfRangeException: Index was outside the bounds of the array.</title><link>https://www.infopathdev.com:443/forums/thread/50040.aspx</link><pubDate>Fri, 18 Dec 2009 08:56:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:50040</guid><dc:creator>ACrush</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/50040.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=50040</wfw:commentRss><description>I have a browser-enabled form that works in InfoPath and fails with System.IndexOutOfRangeException: Index was outside the bounds of the array. &lt;pre&gt;\FormCode.cs:line 36 &lt;br /&gt;at Microsoft.Office.InfoPath.Server.SolutionLifetime.XmlEventExternal.&amp;lt;&amp;gt;c__DisplayClass10.&amp;lt;&amp;gt;c__DisplayClass12.b__b() &lt;br /&gt;at Microsoft.Office.InfoPath.Server.Util.DocumentReliability.InvokeBusinessLogic(Thunk thunk) &lt;br /&gt;at Microsoft.Office.InfoPath.Server.SolutionLifetime.XmlEventExternal.&amp;lt;&amp;gt;c__DisplayClass10.b__a(Object sender, XmlEventArgs e) &lt;br /&gt;at Microsoft.Office.InfoPath.Server.SolutionLifetime.XmlEventExternal.&amp;lt;&amp;gt;c__DisplayClass20.b__1c() &lt;br /&gt;at Microsoft.Office.InfoPath.Server.DocumentLifetime.OMExceptionManager.CallFormCodeWithExceptionHandling(UserMessages userMessages, OMCall d)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The line 36 containing CreateNavigator() was indicated in the exception message in the browser. Why? Is there any discrepancy between line numbering in the source code/dll?&lt;br /&gt;&lt;br /&gt;I think the error might arise from the line with if(...Split()[1]) but the indication is misleading. Any ideas?&lt;br /&gt;&lt;br /&gt;the code goes like this: &lt;br /&gt;&lt;pre&gt;public void Recepients_Changed(object sender, XmlEventArgs e)&lt;br /&gt;        {&lt;br /&gt;            XPathNavigator n = this.CreateNavigator(); //same as this.MainDataSource.CreateNavigator();&lt;br /&gt;            &lt;br /&gt;            switch (e.Operation)&lt;br /&gt;            { &lt;br /&gt;                case XmlOperation.Delete:&lt;br /&gt;                case XmlOperation.ValueChange:&lt;br /&gt;                case XmlOperation.Insert:&lt;br /&gt;                    n.SelectSingleNode(&amp;quot;/my:FormRoot/my:RecepientsCount&amp;quot;, NamespaceManager)&lt;br /&gt;                        .SetValue(string.Empty);&lt;br /&gt;                    n.SelectSingleNode(&amp;quot;/my:FormRoot/my:RecepientsList&amp;quot;, NamespaceManager)&lt;br /&gt;                        .SetValue(string.Empty);&lt;br /&gt;                    n.SelectSingleNode(&amp;quot;/my:FormRoot/my:RecepientsCount&amp;quot;, NamespaceManager)&lt;br /&gt;                        .SetValue(&lt;br /&gt;                            n.Select(&amp;quot;/my:FormRoot/my:Recepients/my:Person&amp;quot;, NamespaceManager)&lt;br /&gt;                                .Count.ToString()&lt;br /&gt;                        );&lt;br /&gt;                    XPathNodeIterator i = n.Select(&amp;quot;/my:FormRoot/my:Recepients/my:Person&amp;quot;, NamespaceManager);&lt;br /&gt;                    while (i.MoveNext())&lt;br /&gt;                    {&lt;br /&gt;                        if (&lt;br /&gt;                        DataSources[&amp;quot;Recepients&amp;quot;].CreateNavigator()&lt;br /&gt;                            .SelectSingleNode(&amp;quot;//dfs:Recepients[@Person=&amp;#39;&amp;quot;+&lt;br /&gt;                            i.Current.SelectSingleNode(&amp;quot;my:AccountId&amp;quot;,NamespaceManager)&lt;br /&gt;                                .Value.Split(@&amp;quot;\&amp;quot;.ToCharArray()[0])[1]&lt;br /&gt;                            +&amp;quot;&amp;#39;]&amp;quot;, NamespaceManager) != null&lt;br /&gt;                            ) &lt;br /&gt;                        { &lt;br /&gt;                        &lt;br /&gt;                        n.SelectSingleNode(&amp;quot;/my:FormRoot/my:RecepientsList&amp;quot;, NamespaceManager)&lt;br /&gt;                            .SetValue(&lt;br /&gt;                                (n.SelectSingleNode(&amp;quot;/my:FormRoot/my:Recepients/my:Person/my:AccountType&amp;quot;, NamespaceManager)&lt;br /&gt;                                    .Value==&amp;quot;User&amp;quot;)&lt;br /&gt;                                ? n.SelectSingleNode(&amp;quot;/my:FormRoot/my:RecepientsList&amp;quot;, NamespaceManager).Value + i.Current&lt;br /&gt;                                    .SelectSingleNode(&amp;quot;my:DisplayName&amp;quot;, NamespaceManager)&lt;br /&gt;                                        .Value+&amp;quot;; &amp;quot;&lt;br /&gt;                                : string.Empty&lt;br /&gt;                            );&lt;br /&gt;                        }&lt;br /&gt;                    }&lt;br /&gt;                    break;&lt;br /&gt;                default: break;&lt;br /&gt;            }&lt;br /&gt;            &lt;br /&gt;        }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;thanks in advance</description></item></channel></rss>