Solved

# Double

Posted on 2008-06-25
175 Views
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
Question by:VBdotnet2005
• 2

LVL 48

Accepted Solution

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))
``````
0

LVL 10

Assisted Solution

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

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

## Featured Post

### Suggested Solutions

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…