Solved

round off decimal number in vb 6

Posted on 2009-07-09
2
525 Views
Last Modified: 2013-11-25
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
Comment
Question by:SGUDAPAT
[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 Comments
 
LVL 16

Accepted Solution

by:
HooKooDooKu earned 500 total points
ID: 24815504
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
 
LVL 1

Author Closing Comment

by:SGUDAPAT
ID: 31601665
Thank you.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

734 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