从单选按钮写入XML文件 [英] Write in XML File from radio button
本文介绍了从单选按钮写入XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想当我单击单选按钮时,应在xml文件中创建一个带有该单选按钮名称的新子节点,并在childnode中像元素一样编写文本框文本.
谢谢
解决方案
尝试一下,希望对您有所帮助
XmlDocument xmlDoc = 新 XmlDocument(); 字符串 myValue = " XmlNode myNode = xmlDoc.CreateElement(Text1.Text); myNode.InnerText = myValue; xmlDoc.AppendChild(myNode); xmlDoc.Save(" );
您是否已阅读文档(如何使用.NET中的XmlDocument类修改和保存XML Framework SDK" [ ^ ])?
Hi guys,
I want when I click on a radio button, a new child node should be created in xml file with the name of that radio button and a textbox text is written in childnode like an element.
Thanks
解决方案
Try this, hope it helps
XmlDocument xmlDoc = new XmlDocument(); string myValue = "Test1" XmlNode myNode = xmlDoc.CreateElement(Text1.Text); myNode.InnerText = myValue; xmlDoc.AppendChild(myNode); xmlDoc.Save("c:/test-doc.xml");
Did you read the documentation ("How To Modify and Save XML with the XmlDocument Class in the .NET Framework SDK"[^])?
这篇关于从单选按钮写入XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文