?
Solved

Rounding

Posted on 2004-04-06
8
Medium Priority
?
206 Views
Last Modified: 2011-10-03
Hello,

Can you please tell me how I can round the numeric contents of a text box to two decimal places?  I presume I would first need to convert the contents of the text box into a double variable...

Thanks in advance for your reply,
Glenn Houston.
0
Comment
Question by:glennston
5 Comments
 
LVL 19

Accepted Solution

by:
Shauli earned 400 total points
ID: 10768657
Private Sub Command1_Click()
   MsgBox FormatNumber("120.5264", 2)
End Sub

S
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 10768674
CDbl(Fix(text1.text, 2))
0
 
LVL 19

Expert Comment

by:Shauli
ID: 10768689
Or with your textbox:

Private Sub Command1_Click()
   MsgBox FormatNumber(Text1.Text, 2)
End Sub

S

0
 
LVL 4

Expert Comment

by:learning_t0_pr0gram
ID: 10769529
Private Sub Command1_Click()
MsgBox Format(Text1.Text, "0.00")
End Sub

could always do that too =\
0
 
LVL 6

Expert Comment

by:PhilAI
ID: 10800874
Well, give someone the points?
0

Featured Post

Technology Partners: 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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

862 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