Solved

Rounding

Posted on 2004-04-06
8
198 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA open file from excel cell 4 44
Using "ScreenUpdating" 6 73
Advice in Xamarin 21 97
Error with a code discussed on this page 5 33
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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

821 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