how to sum all the item in the listbox?

this is my code.. Private Sub Command1_Click() Dim i As Integer For i = 0 To List1.ListCount Label1.Caption = List1.ListCount Next i End Sub Private Sub Command2_Click() List1.AddItem Text1.Text End Sub what is wrong in my code? pls help.. thanks
Submitted byAnonymous (not verified)on Sat, 07/25/2009 - 18:22

How can we get the running Sum of Balance Field in a DBGRID, That is support we want to create an accounting sheet and we want to calculate the running sum like in access we have runningsum property for report,how we can get it on DBGrid Control Thanks
Submitted byAnonymous (not verified)on Fri, 01/21/2011 - 23:29

Dear Jay_7, I was looking for the same answer as you do.. So that I can have a shortcut, rather than figuring it out.. But I ended up, solving it myself, here it is.. :) Private Sub Command1_Click() Dim counter As Integer Dim sum As Integer For counter = lstPrice.ListCount - 1 To 0 Step -1 sum = sum + lstPrice.List(counter) Next counter lblTotal.Caption = sum End Sub Yours truly, Lana

Add new comment