format a s currency ittem in a listview

hi all
how do i format as a currency


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use the C2 string format specifier; e.g.:
Public Class Form1
	Private objArray(5) As Object

	Private Sub OnLoad(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
		objArray(0) = 123.0
		objArray(1) = 57.34
		objArray(2) = 67
		objArray(3) = "NaN"
		objArray(4) = 58
		objArray(5) = 0.05

		Dim tempVal As Decimal
		For Each item In objArray
			lv.Items.Add(If(Decimal.TryParse(item, tempVal), tempVal.ToString("C2"), "Not a number"))
	End Sub
End Class

Open in new window

Produces the following output -Capture.JPG-saige-
ErnestoAuthor Commented:
lv.SubItems.Add(objRead("monto").ToString("C2", CultureInfo.CurrentCulture))

do not work
In your case you will need to use something like:
lv.SubItems.Add(String.Format("{0:C2}", objRead("monto"))

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ErnestoAuthor Commented:
your a %$#$%#$% Genious!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.