title: How can I add up all the values in a listbox?
body: <p>I have a listbox, with an unspecified amount of values.
  They will all be a decimal converted to a string eg</p>
  
  <pre><code>21.10
  32.50
  43.49
  42.00
  </code></pre>
  
  <p>I then want to add these all up and display them in a textbox, how would I go about this?</p>
  
  <p>My guess is I will first need to convert them all from ListItem back to a decimal, for however many times there is an item. I have no idea how to go about this though</p>
  
  <p>This is what i tried(from an oldpost here)</p>
  
  <pre><code>decimal total = (from string S in Listbox.Items select Convert.ToDecimal(S)).Sum();
  </code></pre>
  
  <p>Received This Error:</p>
  
  <blockquote>
    <p>Unable to cast object of type 'System.Web.UI.WebControls.ListItem' to
    type 'System.String'.</p>
  </blockquote>
  
  <p>Thanks!</p>