Solved

Rounding

Posted on 2004-04-06
8
188 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
8 Comments
 
LVL 19

Accepted Solution

by:
Shauli earned 100 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now