|
-
Nov 18th, 2005, 05:12 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Always display 2 digits after decimal point
Hi there,
whats the handiest way to always display 2 digits after a decimal point. Im using a double and i will convert it to String before displaying but i need it to show the 2 decimal places as the example below
Eg
5 -> 5.00
5.0 ->5.00
5.50->5.50
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Nov 18th, 2005, 05:26 AM
#2
Re: Always display 2 digits after decimal point
VB Code:
Dim DoubleVar as Double=5D
MsgBox(DoubleVar.ToString("N2"))
http://msdn.microsoft.com/library/de...ringtopic2.asp
There is a more detailed explanation there of the Double.ToString method.
Bill
-
Nov 18th, 2005, 05:31 AM
#3
Thread Starter
Fanatic Member
Re: Always display 2 digits after decimal point
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|