<?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>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Appendchild onload problem</title><link>https://www.infopathdev.com:443/forums/thread/14984.aspx</link><pubDate>Thu, 11 Jan 2007 16:08:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14984</guid><dc:creator>shaun.nieves</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14984.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14984</wfw:commentRss><description>I really think this is a bug because if this is by design then something is terribly wrong.&lt;br /&gt;I am unable to create two repeating tables programatically even if the calls are separate. &lt;br /&gt;I have one procedure being called in an onafterchange event in one dropdown box and another &lt;br /&gt;procedure being called in an onafterchange event in a second dropdown. The first one fires without&lt;br /&gt;a hitch but the second one always bombs out with the same error. It doesn't matter which one I do &lt;br /&gt;first, the second one always bombs after the first row is inserted with the following error.&lt;br /&gt;&lt;br /&gt;System.NullReferenceException&lt;br /&gt;Object reference not set to an instance of an object.&lt;br /&gt;at InfoPathProject1.InfoPathProject1.State()&lt;br /&gt;at InfoPathProject1.InfoPathProject1.OnLoad(DocReturnEvent e)&lt;br /&gt;at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Does anyone have an idea or know how I can escalate to Microsoft?</description></item><item><title>Re: Appendchild onload problem</title><link>https://www.infopathdev.com:443/forums/thread/14983.aspx</link><pubDate>Fri, 05 Jan 2007 21:13:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14983</guid><dc:creator>shaun.nieves</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14983.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14983</wfw:commentRss><description>Hey Matt thanks for the help. I'm using VB.net managed code. I'm not sure how that would work. i + numRows(which is 17) would be 18 and there wouldn't be a row 18. &lt;br /&gt;&lt;br /&gt;I've identified the problem line of code but it's bombing at the second iteration. The first row is created, the data is filled, the second row is created and when the below line of codes tries to insert the value, the code bombs. Again, I think it's a bug because I tried adding the rows first, then in an onclick event, tried to fill the rows but I get the same error. The only row that is recognizable is row 1. Every row after row 1 is unrecognizable.&lt;br /&gt;&lt;br /&gt;thisXDocument.DOM.selectSingleNode("/my:myFields/my:CodeConcat[" &amp; iState &amp; "]/my:State").text = Code2 + ", " + sName2&lt;br /&gt;&lt;br /&gt;Here is the error&lt;br /&gt;System.NullReferenceException&lt;br /&gt;Object reference not set to an instance of an object.&lt;br /&gt;   at InfoPathProject1.InfoPathProject1.State()&lt;br /&gt;   at InfoPathProject1.InfoPathProject1.OnLoad(DocReturnEvent e)&lt;br /&gt;   at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;My bet is that if you create two separate repeating tables at once, it bugs out the second table. What do you think?</description></item><item><title>Re: Appendchild onload problem</title><link>https://www.infopathdev.com:443/forums/thread/14982.aspx</link><pubDate>Fri, 05 Jan 2007 20:35:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14982</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14982.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14982</wfw:commentRss><description>Hi Shaun,&lt;br /&gt;&lt;br /&gt;I think I see your problem. and it's with these two lines:&lt;br /&gt;&lt;br /&gt;thisXDocument.DOM.selectSingleNode("/my:myFields/my:CodeConcat[" &amp; i &amp; "]/my:Federal").text = Code + ", " + sName&lt;br /&gt;thisXDocument.DOM.selectSingleNode("/my:myFields/my:CodeConcat[" &amp; iState &amp; "]/my:State").text = Code2 + ", " + sName2&lt;br /&gt;&lt;br /&gt;In both loops you are looping from 1 to N, but in the second loop you should be looping from N to 2N in that specific statement,&lt;br /&gt;so depending on the order maybe change it like this:&lt;br /&gt;&lt;br /&gt;thisXDocument.DOM.selectSingleNode("/my:myFields/my:CodeConcat[" &amp; i + numRows &amp; "]/my:Federal").text = Code + ", " + sName&lt;br /&gt;thisXDocument.DOM.selectSingleNode("/my:myFields/my:CodeConcat[" &amp; iState + numRows2 &amp; "]/my:State").text = Code2 + ", " + sName2&lt;br /&gt;&lt;br /&gt;This is just a quick guess, it would be much easier if you gave smaller code chunks that were giving you an error. To do this, &lt;br /&gt;try commenting more and more of your code until it runs without error, and then you've found the error! Or you could switch&lt;br /&gt;to managed code which would be MUCH easier to work with! :) Good luck!</description></item><item><title>Re: Appendchild onload problem</title><link>https://www.infopathdev.com:443/forums/thread/14981.aspx</link><pubDate>Fri, 05 Jan 2007 20:33:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14981</guid><dc:creator>shaun.nieves</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14981.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14981</wfw:commentRss><description>I'm thinking this is an infopath bug. I tried something a little different. I added the rows first and then tried to fill in the data but I got the same error. What I then did was add a button to the form that would fill in the&lt;br /&gt;value of the second row after it was created in the onload function and I get the same error but if I change the button to update a value in the first repeating table, it works just fine.</description></item><item><title>Re: Appendchild onload problem</title><link>https://www.infopathdev.com:443/forums/thread/14980.aspx</link><pubDate>Fri, 05 Jan 2007 16:16:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14980</guid><dc:creator>shaun.nieves</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14980.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14980</wfw:commentRss><description>How do I step into the code? I entered in System.Diagnostics.Debugger.Break() at the beginning of the OnLoad proc however when I click preview, it does not break and the error comes up without telling me the line number. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I should also mention that I don't think it's the code itself. If I flip the order of the repeating table creation, I get the same error. So both procedures work, it's just that they don't work when they are both executed onload. If I run one at a time, they work fine. I even tried moving them to their own procedures and calling them from the onload event but I get the same error.&lt;br /&gt;</description></item><item><title>Re: Appendchild onload problem</title><link>https://www.infopathdev.com:443/forums/thread/14979.aspx</link><pubDate>Fri, 05 Jan 2007 06:30:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14979</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14979.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14979</wfw:commentRss><description>Hi Shaun Nieves,&lt;br /&gt;&lt;br /&gt;Can you explain on which line you got the error? IF you debug it OnLoad it should display the line number for the error.</description></item><item><title>Appendchild onload problem</title><link>https://www.infopathdev.com:443/forums/thread/13019.aspx</link><pubDate>Fri, 05 Jan 2007 00:37:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13019</guid><dc:creator>shaun.nieves</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13019.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13019</wfw:commentRss><description>Hi, I'm trying to load data into two repeating tables onload. The first one works fine but the second one bombs out on the second pass. Here is the error:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;System.NullReferenceException&lt;br /&gt;Object reference not set to an instance of an object.&lt;br /&gt;   at InfoPathProject1.InfoPathProject1.State()&lt;br /&gt;   at InfoPathProject1.InfoPathProject1.OnLoad(DocReturnEvent e)&lt;br /&gt;   at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here is my code:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Federal()&lt;br /&gt;            'Start insert Federal waste codes**********************&lt;br /&gt;&lt;br /&gt;            Dim dataDOM As DOMDocument50 = thisXDocument.DataObjects("FederalWasteCodes").DOM&lt;br /&gt;            dataDOM.setProperty("SelectionNamespaces", "xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"" xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-12T22-07-01"" ")&lt;br /&gt;            Dim numRows As Integer = thisXDocument.GetDOM("FederalWasteCodes").selectNodes("/dfs:myFields/dfs:dataFields/dfs:FederalWasteCodes").length()&lt;br /&gt;            'MsgBox(numRows, MsgBoxStyle.Critical)&lt;br /&gt;&lt;br /&gt;            Dim oParentNode As IXMLDOMNode&lt;br /&gt;            oParentNode = thisXDocument.DOM.selectSingleNode("/my:myFields")&lt;br /&gt;            Dim strFields As String&lt;br /&gt;            strFields = "&amp;lt;my:CodeConcat xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-11-01T00:12:07'&amp;gt;&amp;lt;my:Federal/&amp;gt;&amp;lt;/my:CodeConcat&amp;gt;"&lt;br /&gt;            Dim domXMLNode As IXMLDOMDocument&lt;br /&gt;            domXMLNode = thisXDocument.CreateDOM()&lt;br /&gt;&lt;br /&gt;            domXMLNode.async = False&lt;br /&gt;            domXMLNode.loadXML(strFields)&lt;br /&gt;&lt;br /&gt;            Dim i As Integer&lt;br /&gt;&lt;br /&gt;            For i = 1 To numRows&lt;br /&gt;                Dim Code As String = thisXDocument.GetDOM("FederalWasteCodes").selectSingleNode("/dfs:myFields/dfs:dataFields/dfs:FederalWasteCodes[" &amp; i &amp; "]/@Code").text&lt;br /&gt;                Dim sName As String = thisXDocument.GetDOM("FederalWasteCodes").selectSingleNode("/dfs:myFields/dfs:dataFields/dfs:FederalWasteCodes[" &amp; i &amp; "]/@Short_name").text&lt;br /&gt;                'MsgBox(Code, MsgBoxStyle.Critical)&lt;br /&gt;                thisXDocument.DOM.selectSingleNode("/my:myFields/my:CodeConcat[" &amp; i &amp; "]/my:Federal").text = Code + ", " + sName&lt;br /&gt;                If i &amp;lt;&amp;gt; numRows Then&lt;br /&gt;                    oParentNode.appendChild(domXMLNode.documentElement.cloneNode(True))&lt;br /&gt;                Else&lt;br /&gt;                End If&lt;br /&gt;            Next&lt;br /&gt;&lt;br /&gt;            'End insert Federal waste codes***************&lt;br /&gt;&lt;br /&gt;        End Sub&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub State()&lt;br /&gt;            'Start insert State waste codes****************&lt;br /&gt;            Dim dataDOM2 As DOMDocument50 = thisXDocument.DataObjects("CalWasteCodes").DOM&lt;br /&gt;            dataDOM2.setProperty("SelectionNamespaces", "xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"" xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-12T22-07-01"" ")&lt;br /&gt;            Dim numRows2 As Integer = thisXDocument.GetDOM("CalWasteCodes").selectNodes("/dfs:myFields/dfs:dataFields/dfs:CalWasteCodes").length()&lt;br /&gt;            'MsgBox(numRows2, MsgBoxStyle.Critical)&lt;br /&gt;&lt;br /&gt;            Dim oParentNode2 As IXMLDOMNode&lt;br /&gt;            oParentNode2 = thisXDocument.DOM.selectSingleNode("/my:myFields")&lt;br /&gt;            Dim strFields2 As String&lt;br /&gt;            strFields2 = "&amp;lt;my:CodeConcat xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-11-01T00:12:07'&amp;gt;&amp;lt;my:State/&amp;gt;&amp;lt;/my:CodeConcat&amp;gt;"&lt;br /&gt;            Dim domXMLNode2 As IXMLDOMDocument&lt;br /&gt;            domXMLNode2 = thisXDocument.CreateDOM()&lt;br /&gt;&lt;br /&gt;            domXMLNode2.async = False&lt;br /&gt;            domXMLNode2.loadXML(strFields2)&lt;br /&gt;&lt;br /&gt;            Dim iState As Integer&lt;br /&gt;&lt;br /&gt;            For iState = 1 To numRows2&lt;br /&gt;                Dim Code2 As String = thisXDocument.GetDOM("CalWasteCodes").selectSingleNode("/dfs:myFields/dfs:dataFields/dfs:CalWasteCodes[" &amp; iState &amp; "]/@Code").text&lt;br /&gt;                'MsgBox(Code2, MsgBoxStyle.Critical)&lt;br /&gt;                Dim sName2 As String = thisXDocument.GetDOM("CalWasteCodes").selectSingleNode("/dfs:myFields/dfs:dataFields/dfs:CalWasteCodes[" &amp; iState &amp; "]/@Short_name").text&lt;br /&gt;                'MsgBox(sName2, MsgBoxStyle.Critical)&lt;br /&gt;                'MsgBox(iState, MsgBoxStyle.Critical)&lt;br /&gt;                Dim node As String = thisXDocument.DOM.selectSingleNode("/my:myFields/my:CodeConcat[" &amp; iState &amp; "]/my:State").text&lt;br /&gt;                MsgBox(node, MsgBoxStyle.Critical)&lt;br /&gt;                thisXDocument.DOM.selectSingleNode("/my:myFields/my:CodeConcat[" &amp; iState &amp; "]/my:State").text = Code2 + ", " + sName2&lt;br /&gt;                If iState &amp;lt;&amp;gt; numRows2 Then&lt;br /&gt;                    oParentNode2.appendChild(domXMLNode2.documentElement.cloneNode(True))&lt;br /&gt;                Else&lt;br /&gt;                End If&lt;br /&gt;&lt;br /&gt;            Next&lt;br /&gt;&lt;br /&gt;            'End insert State waste codes******************&lt;br /&gt;        End Sub&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If anyone has any ideas I would greatly appreciate it. Thanks!</description></item></channel></rss>