我应该使用什么以及如何实施? [英] What should I use and how should I implement?

查看:72
本文介绍了我应该使用什么以及如何实施?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要做一个简单的表单,它应该有一个组件(我正在考虑列表框),它显示产品名称,产品计数列表。选择产品时,可以更改计数或从列表中删除项目。列表数据将保存在文本文件中。



我的问题:哪些windows表单组件我应该使用两个显示两列列表?



我应该如何用文件中的项填充该组件?

I need to do simple form which should have a component (I am thinking about listbox) which displays "Product Name", "Product count" list. When you select product it is possible to change the count or remove the item from list. List data will be saved in text file.

My questions: what windows forms component I should use two display two column list?

How should I populate that component with items from file?

推荐答案

我会使用ListView [ ^ ](在详细信息 查看)。

有很多教程可供选择,例如你可以看看C#ListView控件 [ ^ ]。
I would use a ListView[^] (in Details View).
There are many tutorials available, for instance you may look at "C# ListView Control"[^].


ListView或DataGridView对此可以。如果我理解正确,启动数据会保存在文本文件中吗?在这种情况下,您可以使用DataTable存储将要显示的数据,并且您可以根据需要更改该数据(从列表中删除项目,更改计数),如果需要,您可以稍后通过DataTable,并将数据写回到你的文本文件。您可以使用StreamReader从文本文件中读取数据。
ListView or DataGridView can be ok for this. If I understood correctly, starting data is saved in text file? In that case, you can use DataTable to store data that will be shown, and you can change that data as needed (remove item from list, change count), and if you need, you can later go through DataTable, and write data back to your text file. You can use StreamReader to read data from text file.


这篇关于我应该使用什么以及如何实施?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆