Wrox Programmer Forums Getting decimal value
 |
 VB How-To Ask your "How do I do this with VB?" questions in this forum.
 Welcome to the p2p.wrox.com Forums. You are currently viewing the VB How-To 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

October 18th, 2004, 01:50 AM
 snowydust Authorized User Join Date: Jul 2004 Posts: 31 Thanks: 0 Thanked 0 Times in 0 Posts
Getting decimal value

Hi,

I would like to know if there is anyway in vb.net that i can retrieve the decimal value of a double variable. e.g:

dim d as double = 2.6
how to get the .6?

Snowydust
__________________
Snowydust

October 18th, 2004, 10:25 AM
 pradeep_itguy Friend of Wrox Join Date: Feb 2004 Posts: 177 Thanks: 0 Thanked 0 Times in 0 Posts

Hey cant u write ur own funtion for this simple problem? Anyway i shall state the same for u.

1. U can use the floor function to get the integral part of the decimal number. i.e on ur VB.NET IDE type math.floor(UrDecimalNumber)
Eg.. Math.Floor(5.6) would yeild 5 as the result.

2. Then subtract this integral part that u get from the decimal number. This would give u the decimal part that u require.

Eg. 5.6 - 5 = 0.6 (Required Result)

It is not how much we do,
but how much love we put in the doing.

-Mother Theresa

 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 Formattig Decimal mahulda ASP.NET 1.0 and 1.1 Basics 2 July 24th, 2004 03:17 AM