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.

Recommended Answers

All 4 Replies

use this:

decimal moneyvalue = 1921.39m;
            string html = String.Format("Order Total: {0:C}", moneyvalue);
            textBox1.Text = html;
commented: 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?

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.
commented: Thank you for the code sir. +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.