销售点(添加到购物车(列表视图)) [英] Point of Sales(add to cart (listview) )

查看:68
本文介绍了销售点(添加到购物车(列表视图))的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我目前正在使用SQL Server作为数据库在C#中开发POS系统(Windows应用程序)。在我的数据库中,我有一个产品表,其中包含以下字段:条形码(主键),productID,productName,productQty,productSize和
productUnitPrice。

解决方案


这个问题更适合其中一个C#论坛(也许是Windows Forms或C#general),这个论坛专门针对与之相关的问题/问题来自微软的Pos .Net库,在这一点上似乎没有涉及你在
做的任何事情。


话虽如此,答案应该是打电话给在列表视图上添加Items属性的方法,即如果你有一个名为ListView1的列表视图,那么


ListView1.Items.Add(...)


添加有多个重载,选择一个适合您的重载并传递所需的详细信息。我记不起来了,但是添加一个返回ListViewItem或者接受一个(或两个)。一旦你有一个对列表视图中添加的ListViewItem的引用,
然后你可以使用subitems属性来添加其他值,所以代码看起来像这样(注意,这是我的顶部)所以它可能不会编译...我现在没有VS方便检查);


ListViewItem li = listview1.Items.Add(条形码);


li.SubItems.Add(new ListViewItem.SubItem(productname));


li.SubItems.Add(new ListViewItem.SubItem(qty));


li.SubItems.Add(new ListViewItem.SubItem(size));


li.SubItems.Add(new ListViewItem.SubItem(saleprice) );


等。


如果您要一次添加多个项目,请在添加任何项目之前尝试调用BeginUpdate,在添加最后一个项目后尝试调用EndUpdate(这些方法在列表视图控件上),因为这将减少屏幕重绘并加快添加代码。


 


Hi. I'm currently developing a POS system(windows application) in C# with SQL Server as the database. In my database, I have a product table that contains the following fields: barcode(primary key) , productID,productName ,productQty ,productSize, and productUnitPrice.

解决方案

Hi,

This question is better suited to one of the C# forums (Windows Forms or C# general perhaps), this forum is specifically for questions/issues relating to the Pos .Net library from Microsoft, which doesn't seem to be involved with anything you are doing at this point.

Having said that, the answer should be to call the Add method of the Items property on your list view, i.e if you have a listview called ListView1 then

ListView1.Items.Add(...)

Add has several overloads, choose one that works for you and pass in the details required. I can't remember but add either returns a ListViewItem or else accepts one (or both). Once you have a reference to the ListViewItem that was added to the listview, you can then use the subitems property to add the other values, so the code would look something like this (note, this is off the top of my head so it probably doesn't compile... I don't have VS handy at the moment to check);

ListViewItem li = listview1.Items.Add(barcode);

li.SubItems.Add(new ListViewItem.SubItem(productname));

li.SubItems.Add(new ListViewItem.SubItem(qty));

li.SubItems.Add(new ListViewItem.SubItem(size));

li.SubItems.Add(new ListViewItem.SubItem(saleprice));

etc.

If you are adding multiple items at once, try calling BeginUpdate before adding any items and EndUpdate after adding the last item (these methods are on the list view control) as this will reduce screen redraws and speed up the add code.

 


这篇关于销售点(添加到购物车(列表视图))的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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