Results 1 to 2 of 2

Thread: List box addition

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2003
    Posts
    1

    Question List box addition

    I have create a listbox which contains a list of numbers representing times such as
    1.21
    2.34
    4.12

    i have a label at the bottom and i would like to perform a calculation on the numbers in the list box to add them together and display the total result in the label

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    like this maybe ...
    VB Code:
    1. Dim dbl As Double = Nothing
    2.         Dim stritem As String
    3.         For Each stritem In ListBox1.Items
    4.             dbl += Convert.ToDouble(stritem)
    5.         Next
    6.         MessageBox.Show(dbl.ToString())
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

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