[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

convert double to integer

Posted on 2006-06-30
4
Medium Priority
?
403 Views
Last Modified: 2010-08-05
vb2005

i finally decided to turn option strict on, and i get a bunch of implicit conversion warnings. what is the best way to convert a Double to an Integer, without using microsoft.visualbasic namespace?
0
Comment
Question by:newyuppie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 1000 total points
ID: 17021997
You could use the Convert class:

        Dim dNum As Double = 10.4
        Dim iNum As Integer = Convert.ToInt32(dNum)
0
 
LVL 13

Author Comment

by:newyuppie
ID: 17022010
perfect, so that would also truncate the decimals right? no need for convert.toint32(math.truncate(dnum))?
0
 
LVL 18

Expert Comment

by:Ravi Singh
ID: 17022028
Hi,

Convert.ToInt32 will round up from above .5, if you only want the integral part of the number then you'll have to call the truncate method.

0
 
LVL 13

Author Comment

by:newyuppie
ID: 17022292
thank you!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question