Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2008 > Visual Basic 2008 Essentials
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Essentials section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 17th, 2010, 11:09 AM
Authorized User
Points: 55, Level: 1
Points: 55, Level: 1 Points: 55, Level: 1 Points: 55, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb How to separate double number

Hi everyone,
Somebody can help me , please? I have VB 2008 Exp edition and I'm starting to learn something about programing! The question is: how can I extract the numbers behind the point.
For example:
I have the double number 12.345 - so I need to separate the number 12 from 0.345, because I need them both, even the number 12 and even the number 0.345!! For example I'll use 12 * 123 and 0.345 * 456!!!!
I hope it's clear! Thank's very much in advance!
Reply With Quote
  #2 (permalink)  
Old April 17th, 2010, 12:56 PM
Friend of Wrox
 
Join Date: Dec 2008
Location: , , .
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default

Math.Floor can give you the integer part of the double, and then a simple minus should give you the decimal part.
Code:
Module Module1

    Sub Main()
        Dim d As Double = 123.456
        Dim i As Integer
        i = Math.Floor(d)
        'd - i can give you the decimal part
    End Sub

End Module
Reply With Quote
  #3 (permalink)  
Old April 27th, 2010, 04:11 AM
Authorized User
Points: 55, Level: 1
Points: 55, Level: 1 Points: 55, Level: 1 Points: 55, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default thanx

thanx for replaying!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Separate user tables? Clint PHP Databases 3 May 11th, 2012 06:06 AM
How to add a line number/Row number- need to use it for page breaks naijacoder XSLT 7 September 27th, 2009 09:42 PM
separate a string with whitespace petergoodman XSLT 8 July 8th, 2008 01:56 AM
Two separate menu from one sitemap? KieshaJ310 ASP.NET 2.0 Basics 5 July 4th, 2007 01:31 AM
Search separate C from CR topshed Classic ASP Databases 2 December 29th, 2005 08:58 AM



All times are GMT -4. The time now is 07:37 PM.


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