Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / November 2005

Tip: Looking for answers? Try searching our database.

Removing Fields from Section using C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Boris Kleynbok - 18 Nov 2005 21:03 GMT
I am using C# in Form.cs

Having trouble traversing the IXMLDOM

All in all I need to programmatically remove all the repeating sections
fields.

Kind  of restoring section to its original state.

This section could be already repeated and a button on the section should
remove the fields.

try
            {
                IXMLDOMNodeList nodeList =
thisXDocument.DOM.selectNodes("/mstns:SHORT_SEARCH/mstns:INSTRUMENT");
                    foreach(IXMLDOMNode node in nodeList )
                        {
                        if ( node.selectSingleNode("mstns:INST_NAME").text !="" )
                                {
                           
                           
                       
                                //REMOVE DEED
                                //REMOVE MORTGAGE
                       
                                //    node.removeChild(node.selectSingleNode("mstns:INST_NAME");
/*

                                //REMOVE ASSIGNEMENT

                                if (node.selectSingleNode("mstns:ASSIGNEMENT").text !="")
                                {
                                    node.removeChild(node.selectSingleNode("mstns:ASSIGNEMENT"));
                                }

                                //REMOVE AGREEMENT

                                if (node.selectSingleNode("mstns:AGREEMENT").text !="")
                                {
                                    node.removeChild(node.selectSingleNode("mstns:AGREEMENT"));
                                }

                                //REMOVE BINDED INST

                                if (node.selectSingleNode("mstns:BINDED_INST").text !="")
                                {
                                    node.removeChild(node.selectSingleNode("mstns:BINDED_INST"));
                                }
                           
                            */
                           
                            }
               
                }
            }
            catch(Exception ex)
            {
                thisXDocument.UI.Alert(ex.Message );
           
            }

Will be much ablidged.

Signature

Wed Developer
Dot Com Factory

Franck Dauché - 20 Nov 2005 21:01 GMT
Hi Boris,

Are you saying that you code that you posted didn't work?  Can you tell us
more about you need exactly.
Because, indeed to remove child from a repeating group in C#, you can use:
IXMLDOMNodeList oNodes =
thisXDocument.DOM.selectNodes("/my:myFields/my:group1/my:group2");
foreach (IXMLDOMNode oNode in oNodes)
{
 oNode.parentNode.removeChild(oNode);
}

Regards,

Franck Dauché

> I am using C# in Form.cs
>
[quoted text clipped - 59 lines]
>
> Will be much ablidged.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.