Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 528
  • Last Modified:

round off decimal number in vb 6

I want to round off..........not exactly round off.it should be trim.
I have a number:2.05012413. I want make it 2.0501. It should have only four digits after decimal.
how do I do it in Vb6?
0
SGUDAPAT
Asked:
SGUDAPAT
1 Solution
 
HooKooDooKuCommented:
If this is for display purposes, you can convert it to a string with Format

Format$( MyDecimalValue, "0.0000" );

If you want to actually change the value to round off to 4 decimals, use the Round function

MyDecimalValue = Round( MyDecimalValue, 4 )
0
 
SGUDAPATAuthor Commented:
Thank you.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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