如何将列表框项目保存到文件 [英] How to save listbox items to file
问题描述
我想将我的列表框项目保存到文件中,这样当我关闭表单时它会保存,这样当我打开时应用程序列表框中的项目将重新加载,它们将在那里。我需要在form1_closed事件中有代码。另外
如果有任何方法可以保存然后列出框项目,(除了数据库)我想知道如何。代码会有所帮助。
谢谢,
对列表框中的对象使用序列化。
https://msdn.microsoft.com/en-us/library/7ay27kt9(v = vs.110)。 aspx
https://msdn.microsoft.com/en-us/library/szzyf24s(v = vs.110).aspx
https ://msdn.microsoft.com/en-us/library/ms973893.aspx
问候,
的Thorsten
Hi,
I would like save my listbox items to a file, so that when I close the form it will at that time save, so that when I open the app the items in the listbox will reload and they will be there. I would need to have the code in the form1_closed event. Also if there is any way to save then listbox items, (other than database) I would like to know how to. The code would help.
Thanks,
Hi,
use Serialization for the objects in your listbox.
https://msdn.microsoft.com/en-us/library/7ay27kt9(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/szzyf24s(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/ms973893.aspx
Regards,
Thorsten
这篇关于如何将列表框项目保存到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!