Solved

Double

Posted on 2008-06-25
3
176 Views
Last Modified: 2010-04-23
How can I get a result like :  19.53 % instead of 19.53125%  when dividing number and get a %?


dim i as integer = 100
dim x as integer  = 5.12
dim tl as double ?

tl = i / x
0
Comment
Question by:VBdotnet2005
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 50 total points
ID: 21870929
Hi VBdotnet2005,

Try this way:
        Dim i As Double = 100
        Dim x As Double = 5.12
        Dim tl As Double = (i / x) / 100
        Debug.WriteLine(FormatPercent(tl.ToString))

Open in new window

0
 
LVL 10

Assisted Solution

by:margajet24
margajet24 earned 50 total points
ID: 21871662
tl = (Double)i / (Double)x

type cast both i and x to double first..
0
 
LVL 10

Expert Comment

by:margajet24
ID: 21871677
tl = CDbl(i) / CDbl(x)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now