Solved

Double

Posted on 2008-06-25
3
180 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
[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
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 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