Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting a number to 1000s...

Status
Not open for further replies.

steverbs

Programmer
Jul 17, 2003
253
GB
Hi all.

Can anyone tell me how, using VB.NET, to format an SQL Server Money datatype to display the value in 1000s? So that 678900 would be 679 and 98 would be 0 etc.

Thank you.

Stephen.
 
You could try the Integer divide operator \ ie

678900\1000
98\1000
myvar\1000

Hope this helps
 
I had actually tried that, but it kept giving me undesirable results (i.e. 900 / 1000 = 0.9, when I need 0). I think I may have found what I am after though. One of my colleagues just pointed out the '0,' format string that can be applied in the ToString method of a numeric Type.

I'll see how it does.

Stephen.
 
You are using / the divide operator, I suggested using \, the Integer divide operator


678900\1000 = 678 (exactly - no fractional part)
98\1000 = 0 (exactly - no fractional part)

Hope this helps.

 
Oh, right. I'll give that a try then.

Thanks for your help.

Stephen.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top