• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:


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
  • 2
2 Solutions
Jorge PaulinoIT Pro/DeveloperCommented:
Hi VBdotnet2005,

Try this way:
        Dim i As Double = 100
        Dim x As Double = 5.12
        Dim tl As Double = (i / x) / 100

Open in new window

margajet24IT Business AnalystCommented:
tl = (Double)i / (Double)x

type cast both i and x to double first..
margajet24IT Business AnalystCommented:
tl = CDbl(i) / CDbl(x)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now