Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

help formating double

Posted on 2009-05-18
3
Medium Priority
?
168 Views
Last Modified: 2012-05-07
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

0
Comment
Question by:Tania_Farmer
  • 2
3 Comments
 
LVL 48

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 24411086
If you format a number, the results will always be a String.

Wayne
0
 
LVL 16

Expert Comment

by:ToddBeaulieu
ID: 24411108
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
 
LVL 48

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 1000 total points
ID: 24411431
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question