Results 1 to 7 of 7

Thread: Calculation using list box items

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2007
    Posts
    21

    Calculation using list box items

    Hi,

    I am benefited by this forum to a very great extent. Now for the past two days trying to do some calculations in the List Box items. I have two list boxes and the first list box contains the contents of a text file. Once the user clicks the item in List Box 1 same is added in List Box 2 and removed from List Box 1. This I am able to do without any difficulty. But I need to count the number of items added in List Box 2 and also the sum of a string in the List Box 2. I am pasting the code to this mail. Kindly advise me in this regard.
    Code:
    Private Sub lstDisplayrecord_Click()
    Dim Searchstring As String
    Dim Reasoncode As String
    Dim newstring As String
    Dim Linecnt As Integer
    Dim Totamt As String
    Searchstring = lstDisplayrecord.List(lstDisplayrecord.ListIndex)
    lblAccount = Mid(Searchstring, 10, 2)
    lblAccnum = Mid(Searchstring, 12, 15)
    lblTrandate = Format(Mid(Searchstring, 141, 8), "00/00/0000")
    lblName = Mid(Searchstring, 27, 40)
    lblAmount = Format(Mid(Searchstring, 116, 15) * 0.01, "#############.00")
    Reasoncode = InputBox("Enter Reason Code", "Reason Code", "01")
    'If Reasoncode = "01" Or "02" Or "03" Or "04" Or "05" Then
    Totamt = Totamt + lblAmount
    Searchstring = Left(Searchstring, Len(Searchstring) - 2) & Reasoncode
    lstrejectecs.AddItem Searchstring
    lblrejecsamt = Format(Totamt, "#############.00")
    Linecnt = Linecnt + 1
    lblrejecsnum = Linecnt
    lstDisplayrecord.RemoveItem lstDisplayrecord.ListIndex
    End Sub
    Last edited by Hack; Dec 20th, 2007 at 10:33 AM. Reason: Added Code Tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width