コード例 #1
0
 private void Clean_btn_Click(object sender, EventArgs e)
 {
     ShopingList_lst.Items.Clear();
     total          = 0;
     Price_lbl.Text = total.ToString();
     Price_lbl.Refresh();
 }
コード例 #2
0
        private void CarroCompraList_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListView.SelectedListViewItemCollection remove = ShopingList_lst.SelectedItems;

            foreach (ListViewItem item in remove)
            {
                total -= ((Product)item.Tag).Price;
                ShopingList_lst.Items.Remove(item);

                Price_lbl.Text = total.ToString();
                Price_lbl.Refresh();
            }
        }
コード例 #3
0
        private void AddItemToShoppingCart(Product product)
        {
            ListViewItem item = new ListViewItem(product.Row)
            {
                Tag = product
            };

            ShopingList_lst.Items.Add(item);

            total         += product.Price;
            Price_lbl.Text = total.ToString();
            Price_lbl.Refresh();
        }