The node to be removed is not a child of this node

suzannerabbit

New Member
I have code that is supposed to either add an XmlElement to the root element of a document, or replace an existing element if there is one. Here is my code:\[code\]if (existingInfo != null){ existingInfo.ParentNode.ReplaceChild(existingInfo, newInfo);}else{ this.rootElement.AppendChild(info)}configDocument.Save(this.filePath);\[/code\]If I am appending a new item this is not a problem. However when I try to add a new item I get an ArgumentException stating "The node to be removed is not a child of this node"This is a 2.0 application.
 
Back
Top