help formating double

Hi,
I have the below code.

How do I format the p.value so its stays a double and can be sorted in my listview but shows:

$#,##.##

Thanks
T
Function getPrice(ByVal query As XElement, ByVal vehicleValue As String) As Double
 
    			Dim priceResult = From p In query...<price> _
                      			Where p.@vehicle = vehicleValue _
                      			Select Double.Parse(p.Value)
 
    			Return priceResult.FirstOrDefault()
		End Function

Open in new window

Tania_FarmerAsked:
Who is Participating?
 
Wayne Taylor (webtubbs)Connect With a Mentor Commented:
Tania_Farmer,

Although the displayed number will need to be a string, you could always store the "raw" number in the Tag property of the ListViewItem.

Wayne
0
 
Wayne Taylor (webtubbs)Commented:
If you format a number, the results will always be a String.

Wayne
0
 
ToddBeaulieuCommented:
tubbs is right. Sorting numbers continues to be harder than it should be. Take a look at this article on ICompare.

http://madebits.com/articles/numsort/index.php
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.