<?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: removechild strange</title><link>https://www.infopathdev.com:443/forums/thread/13903.aspx</link><pubDate>Wed, 02 Nov 2005 23:06:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13903</guid><dc:creator>franck</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13903.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13903</wfw:commentRss><description>Hi,&lt;br /&gt;&lt;br /&gt;Your code can't work because when you delete the first node.  everything is shifted by 1: 2 becomes 1.  Next loop, you target i=2 (you then miss 1 that used to be 2) and so on.&lt;br /&gt;&lt;br /&gt;Try to always delete Details[1] not "i", or try to use something like:&lt;br /&gt;thisXDocument.DOM.selectNodes("/my:myFields/my:group1/my:group2")&lt;br /&gt;Dim oNN As IXMLDOMNode&lt;br /&gt;For Each oNN In thisXDocument.DOM.selectNodes("/my:myFields/my:group1/my:group2")&lt;br /&gt;  oNN.parentNode.removeChild(oNN)&lt;br /&gt;Next&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;&lt;br /&gt;Franck Dauché</description></item><item><title>removechild strange</title><link>https://www.infopathdev.com:443/forums/thread/12655.aspx</link><pubDate>Wed, 02 Nov 2005 21:27:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12655</guid><dc:creator>nkelkar</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12655.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12655</wfw:commentRss><description>A very very strange removechild error, or I am missing something really important.&lt;br /&gt;&lt;br /&gt;Removing all rows in a repeating table using removechild with vb.net code as below:&lt;br /&gt;&lt;br /&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;br /&gt;01 Dim numRows = thisXDocument.DOM.selectNodes("//d:Details").length()&lt;br /&gt;02 Dim deleteNode As IXMLDOMNode&lt;br /&gt;03 thisXDocument.UI.Alert("Total of " &amp; numRows &amp; " to be deleted")&lt;br /&gt;04 For i = 1 To numRows&lt;br /&gt;05    thisXDocument.UI.Alert("Deleting Row " &amp; i)&lt;br /&gt;06    deleteNode = thisXDocument.DOM.selectSingleNode("//d:Details[" &amp; i &amp; "]")&lt;br /&gt;07    If deleteNode Is Nothing Then&lt;br /&gt;08        ' Do Nothing&lt;br /&gt;09    End If&lt;br /&gt;10    deleteNode.parentNode.removeChild(deleteNode)&lt;br /&gt;11 Next i&lt;br /&gt;&lt;/font id="Courier New"&gt;&lt;/font id="size2"&gt;&lt;br /&gt;&lt;br /&gt;Now if the Repeating Table had 10 rows, I would assume the code above removes all the 10 rows, BUT NO; It removes Rows 1,3,5,7,9 and leaves behind Rows 2,4,6,8,10. And while doing that it does alert at line number 5, 'Deleting Row 1', 'Deleting Row 2', 'Deleting Row 3', etc so on for all 10 rows. numRows contains a value of '10' at line number 01 and alerts the value correctly at line number 03&lt;br /&gt;&lt;br /&gt;So in the repeating table, we now have Rows 2,4,6,8,10&lt;br /&gt;&lt;br /&gt;Next I execute the code, and Row 4 &amp; Row 8 (from the original table) are still there.&lt;br /&gt;&lt;br /&gt;Its skipping a row everytime.&lt;br /&gt;&lt;br /&gt;Any thoughts? I have to resolve this. Any other options to remove all rows in a repeating table?&lt;br /&gt;&lt;br /&gt;Thanks.</description></item></channel></rss>