Solved

help formating double

Posted on 2009-05-18
3
160 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 47

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 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with checking if excel exist in client's computer 9 43
Library to convert HTML to PDF. 8 57
Converting C# Objects into JSON file 7 66
VB.NET HttpWebRequest 12 58
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now