Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 23rd, 2004, 04:50 AM
Authorized User
 
Join Date: Feb 2004
Location: Delhi, Delhi, India.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mahulda
Default Formattig Decimal

Hi,
How Do I Format a Decimal to 2 places of decimal in VB.Net
Currentl I am doing variablename.tostring("n").
But i want to keep it as a decimal variable

__________________
-.. -..
  #2 (permalink)  
Old July 23rd, 2004, 08:31 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What do you mean by "keep it"? Keep it for what? Do you mean you want to retain the data type and round it to 2 decimal places?
  #3 (permalink)  
Old July 24th, 2004, 03:17 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

When you use variablename.tostring("n") your variable is still as decimal but here .NET creates a new string variable according to your decimal variable and your format.

--------------------------------------------
Mehdi
I'm waiting for your better idea.


Similar Threads
Thread Thread Starter Forum Replies Last Post
decimal data type all 0's after decimal gobotsoup SQL Server ASP 1 February 28th, 2007 02:32 PM
decimal harpua Beginning PHP 1 November 3rd, 2005 10:17 PM
Two decimal places only pallone Javascript How-To 5 February 2nd, 2005 12:35 AM
Decimal check Nitin_sharma Javascript 4 November 25th, 2004 12:03 PM
Getting decimal value snowydust VB How-To 1 October 18th, 2004 10:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.