库存程序保存到XML文件 [英] Inventory program saving to XML file
本文介绍了库存程序保存到XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个清单程序,我想加载并保存到XML文件.我在DataGridView中有一个名为douglasdata的DataGridView和4列(Engine,Item,Count,Engine上的位置).我想将数据输入到程序中,然后保存到名为Inventory的xml文件中.我创建了加载并保存"按钮.任何答复都将有所帮助.
谢谢!
I am writing an Inventory program and I am wanting to Load and Save to an XML file. I have a DataGridView named douglasdata and 4 columns (Engine, Item, Count, Location on Engine) in the DataGridView. I want to input data into the program and then save to the xml file named Inventory. I have the Load and Save button created. Any responses are helpful.
Thanks!
推荐答案
使用4列创建数据表对象并将其绑定到网格.在保存按钮中单击事件DataTable.AcceptChanges()并调用DataTable.WriteXml()方法.
WriteXml()方法具有许多重载.
Create a data table object with your 4 columns and bind that to the grid. In the save button click event DataTable.AcceptChanges() and call the DataTable.WriteXml() method.
The WriteXml() method has many overloads.
这篇关于库存程序保存到XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文