Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Double

Posted on 2008-06-25
3
Medium Priority
?
182 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 200 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 200 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

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 article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

618 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