-
Mar 19th, 2017, 05:18 PM
#1
Thread Starter
New Member
how to get sum of lisview vb.net in totalamount
someone can teach me how to get the sum of specific column in listview to get the total amount and it goes to label.
i hope someone can give me example for this.. thanks!
-
Mar 19th, 2017, 09:01 PM
#2
Re: how to get sum of lisview vb.net in totalamount
How are the values in the column formatted (i.e. $100.00 or similar)?
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 19th, 2017, 09:08 PM
#3
Re: how to get sum of lisview vb.net in totalamount
By the way... Your thread is a question, and not a Poll. I'll ask a moderator to revise your thread.
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 20th, 2017, 05:19 AM
#4
Thread Starter
New Member
Re: how to get sum of lisview vb.net in totalamount
Originally Posted by .paul.
By the way... Your thread is a question, and not a Poll. I'll ask a moderator to revise your thread.
for example the column of listview total amount is column 5 then i want all total amount will apear at the label as long listview get the total amount of the certain column.. i need help!
-
Mar 20th, 2017, 07:21 AM
#5
Thread Starter
New Member
Re: how to get sum of lisview vb.net in totalamount
can someone help me to fix this code:
i want to subtract the quantity i add in the listview.
this is my code:
if i add the items into my listview my other listview productlistitems the qty will be minus.
Code:
Public Function saveOrderProduct(ByVal product_name) As Boolean
'Saving Product'
Dim lsv As Integer = CInt(FRMProductList.lsv_productlist.SelectedItems(0).SubItems(3).Text.ToString())
Dim is_productfound As Boolean = False
Dim regDate As Date = Date.Now()
Dim strDate As String = regDate.ToString("dd-MM-yyyy")
Dim cc As New Cashier_Class
Dim pc As New Product_Class
cc.product_name = FRMCashier.txt_productname.Text
cc.product_category = FRMCashier.txt_productcategory.Text
cc.product_price = Convert.ToDecimal(FRMCashier.txt_productprice.Text)
cc.product_quantity = Convert.ToInt32(FRMCashier.txt_productquantity.Text)
pc.product_name = cc.product_name
pc.product_category = cc.product_category
pc.product_price = cc.product_price
pc.product_quantity = lsv - Convert.ToInt32(FRMCashier.txt_productquantity.Text)
cc.product_total = Convert.ToDecimal(FRMCashier.txt_totalamount.Text)
cc.prouct_date = strDate
GLOBAL_VARS.product_itemsorder.Add(cc)
Cashier_Class.populateProductOrder(FRMCashier.lsv_productitems)
GLOBAL_VARS.product_list.Add(pc)
Product_Class.populateProductlistsubtract(FRMProductList.lsv_productlist)
MsgBox("Order Added", MsgBoxStyle.Information)
Return (is_productfound)
End Function
Public Shared Sub populateProductlistsubtract(ByVal lsvproductlist As ListView)
'Populate Productlist'
lsvproductlist.Items.Clear()
For Each pc As Product_Class In GLOBAL_VARS.product_list
Dim pcl As Integer = lsvproductlist.Items.Count
With lsvproductlist
.Items.Add(pc.product_name)
.Items(pcl).SubItems.Add(pc.product_category)
.Items(pcl).SubItems.Add(Convert.ToDecimal(pc.product_price))
.Items(pcl).SubItems.Add(Convert.ToDecimal(pc.product_quantity))
End With
Next
End Sub
Please someone help me to solve this problem.. HUHUHUHUHHU!!!
Last edited by Shaggy Hiker; Mar 20th, 2017 at 10:29 AM.
Reason: Added CODE tags.
-
Mar 20th, 2017, 07:23 AM
#6
Thread Starter
New Member
Re: how to get sum of lisview vb.net in totalamount
it keeps add in the row of listview huhuhuhuhuhuh .. helpppppppppppppppppppp!!
-
Mar 20th, 2017, 10:30 AM
#7
Re: how to get sum of lisview vb.net in totalamount
I edited the post to add [CODE][/CODE] tags such that the code looks better. You can do this by pressing the # button and pasting the code between the resulting tags, or adding the code, then highlighting it and pressing the # button.
My usual boring signature: Nothing
-
Mar 21st, 2017, 04:48 AM
#8
Thread Starter
New Member
Re: how to get sum of lisview vb.net in totalamount
Code:
Public Function saveOrderProduct(ByVal product_name) As Boolean
'Saving Product'
Dim lsv As Integer = CInt(FRMProductList.lsv_productlist.SelectedItems(0).SubItems(3).Text.ToString())
Dim is_productfound As Boolean = False
Dim regDate As Date = Date.Now()
Dim strDate As String = regDate.ToString("dd-MM-yyyy")
Dim cc As New Cashier_Class
Dim pc As New Product_Class
cc.product_name = FRMCashier.txt_productname.Text
cc.product_category = FRMCashier.txt_productcategory.Text
cc.product_price = Convert.ToDecimal(FRMCashier.txt_productprice.Text)
cc.product_quantity = Convert.ToInt32(FRMCashier.txt_productquantity.Text)
pc.product_name = cc.product_name
pc.product_category = cc.product_category
pc.product_price = cc.product_price
pc.product_quantity = lsv - Convert.ToInt32(FRMCashier.txt_productquantity.Text)
cc.product_total = Convert.ToDecimal(FRMCashier.txt_totalamount.Text)
cc.prouct_date = strDate
GLOBAL_VARS.product_itemsorder.Add(cc)
Cashier_Class.populateProductOrder(FRMCashier.lsv_productitems)
GLOBAL_VARS.product_list.Add(pc)
Product_Class.populateProductlistsubtract(FRMProductList.lsv_productlist)
MsgBox("Order Added", MsgBoxStyle.Information)
Return (is_productfound)
End Function
Public Shared Sub populateProductlistsubtract(ByVal lsvproductlist As ListView)
'Populate Productlist'
lsvproductlist.Items.Clear()
For Each pc As Product_Class In GLOBAL_VARS.product_list
Dim pcl As Integer = lsvproductlist.Items.Count
With lsvproductlist
.Items.Add(pc.product_name)
.Items(pcl).SubItems.Add(pc.product_category)
.Items(pcl).SubItems.Add(Convert.ToDecimal(pc.product_price))
.Items(pcl).SubItems.Add(Convert.ToDecimal(pc.product_quantity))
End With
Next
End Sub
I so confuse with my program huhuhu i need badly help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|