0

I need help i'm out of ideas, i don't know how to add numbers in a currency format. need help please.

Thank you in advance.

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by codeorder
Featured Replies
  • See if this helps. [CODE] Dim dTotal As Double = 0 '// for adding total. For Each itm As ListViewItem In ListView1.Items '// loop thru items. With itm.SubItems(1) '// shorten code for Column 2 items. '// check if Not Nothing, add to total. If Not .Text = Nothing Then dTotal … Read More

-1

use this:

decimal moneyvalue = 1921.39m;
            string html = String.Format("Order Total: {0:C}", moneyvalue);
            textBox1.Text = html;
Comments
c# code in vb.net forum
0

I'm using listview sir.

i have list of prices in my listview ( in currency format ) and i want to get the sum of it. How will i do it sir?

1

See if this helps.

Dim dTotal As Double = 0 '// for adding total.
        For Each itm As ListViewItem In ListView1.Items '// loop thru items.
            With itm.SubItems(1) '// shorten code for Column 2 items.
                '// check if Not Nothing, add to total.
                If Not .Text = Nothing Then dTotal += CDbl(.Text) '// converting currency to Double will remove the $ symbol.
            End With
        Next
        MsgBox("Total : " & CDbl(dTotal).ToString("c")) '// display total with currency format.
Comments
Thank you for the code sir.
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.