Solved

Double

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

10 Experts available now in Live!

Get 1:1 Help Now