我一直在使用xml,并且陷入了保存/加载的方面。我想从应用程序关闭时将文本框中的信息保存到xml文件中,但是当应用程序运行时,我无法关闭带有右上角“X”的应用程序。我尝试删除xml文件并重新创建它,但这仍然没有帮助C#应用程序不保存为xml
我得到了应用程序关闭现在和保存功能与xml工作但是负载函数没有经过它的foreach循环来添加信息从xml回到应用
XmlDocument xDoc = new XmlDocument();
xDoc.Load(path + place);
foreach(XmlNode xNode in xDoc.SelectNodes("ClientMeasurements\\Client"))
{
Client c = new Client();
c.Name = xNode.SelectSingleNode("Name").InnerText;
c.InitialForearm = xNode.SelectSingleNode("InitialForearm").InnerText;
c.InitialUpperArmR = xNode.SelectSingleNode("InitialUpperArmRight").InnerText;
c.InitialUpperArmL = xNode.SelectSingleNode("InitialUpperArmLeft").InnerText;
c.InitialChest = xNode.SelectSingleNode("InitialChest").InnerText;
c.InitialWaist = xNode.SelectSingleNode("InitialWaist").InnerText;
c.InitialHips = xNode.SelectSingleNode("InitialHips").InnerText;
c.InitialThighR = xNode.SelectSingleNode("InitialThighRight").InnerText;
c.InitialThighL = xNode.SelectSingleNode("InitialThighLeft").InnerText;
c.InitialCalfR = xNode.SelectSingleNode("InitialCalfRight").InnerText;
c.InitialCalfL = xNode.SelectSingleNode("InitialCalfLeft").InnerText;
c.MostRecentForearm = xNode.SelectSingleNode("MostRecentForearm").InnerText;
c.MostRecentUpperArmR = xNode.SelectSingleNode("MostRecentUpperArmRight").InnerText;
c.MostRecentUpperArmL = xNode.SelectSingleNode("MostRecentUpperArmLeft").InnerText;
c.MostRecentChest = xNode.SelectSingleNode("MostRecentChest").InnerText;
c.MostRecentWaist = xNode.SelectSingleNode("MostRecentWaist").InnerText;
c.MostRecentHips = xNode.SelectSingleNode("MostRecentHips").InnerText;
c.MostRecentThighR = xNode.SelectSingleNode("MostRecentThighRight").InnerText;
c.MostRecentThighL = xNode.SelectSingleNode("MostRecentThighLeft").InnerText;
c.MostRecentCalfR = xNode.SelectSingleNode("MostRecentCalfRight").InnerText;
c.MostRecentCalfL = xNode.SelectSingleNode("MostRecentCalfLeft").InnerText;
client.Add(c);
listView1.Items.Add(c.Name);
}
}
你是什么意思,你不能点击关闭按钮?它变灰了吗?点击它时它会挂起吗? – mclaassen
当我点击它时,该应用程序无响应。它不灰色,按钮点击,但不会关闭应用程序。 –
您是否尝试过放置断点并查看哪行代码或方法调用令人不安? – TheVillageIdiot