Solved

help formating double

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

746 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

9 Experts available now in Live!

Get 1:1 Help Now