VB程序员博客

VB程序开发

我将一些信息写入xml文件,做了个按钮,第一次点击按钮能成功写入xml,第二次点击按钮,程序运行到dataelement.AppendChild(elem)的时候报错:
未处理的“System.ArgumentException”类型的异常出现在 System.Xml.dll 中。

其他信息: 要插入的节点出自不同的文档上下文。
部分代码如下,请高手帮我分析分析! 谢谢!     
For Each it In DataGridView_dataelement.Rows
            elem = FormBrowser.tpldoc.CreateElement("elem")
            If it.Cells(0).Value <> "" And it.Cells(1).Value <> "" And it.Cells(2).Value <> "" Then
                elem.SetAttribute("from", it.Cells(0).Value)
                elem.SetAttribute("to", it.Cells(1).Value)
                elem.SetAttribute("toelementtype", it.Cells(2).Value)
                dataelement.AppendChild(elem)要插入的节点出自不同的文档上下文。
不是已经告诉你了么。要插入的节点出自不同的文档上下文。
不是已经告诉你了么。


专题:

栏目: