|
-
Nov 20th, 2000, 12:40 PM
#1
Thread Starter
Lively Member
I would like to have results show in my txt box with no more than 2 places after decimal (0.00). I tried selecting the data format property on the txt box and setting it to how I would like, but it doesn't seem to do anything. Ideas?
Thank You! (again)
-
Nov 20th, 2000, 12:43 PM
#2
Junior Member
Code:
dVal = 3.141592654
Text1.Text = Format(dVal,"#,##0.00")
-
Nov 20th, 2000, 12:51 PM
#3
Thread Starter
Lively Member
I'm confused.
1. What does the "dVal = 3.141592654" represent/do
2. Where does this go?
-
Nov 20th, 2000, 01:20 PM
#4
-
Nov 20th, 2000, 01:48 PM
#5
Thread Starter
Lively Member
Maybe I'm explaining this wrong.
This is what I have now:
txtAve.Text = (Val(txt1a) + Val(txt2a)) / (Val(txt1) + Val(txt2))
Currently when you click the cmd button that calculates txtAve's result, you get multiple positions past the decimal. I want to limit how many spaces.
I'm sorry if I've made this so confusing.
Thanks again.
-
Nov 20th, 2000, 04:49 PM
#6
Do you want to round the final answer?
Because you can use the Round function to do it.
Code:
'Round(number,decimal place)
'=Round(number,2)
txtAve.Text = Round((Val(txt1a) + Val(txt2a)) / (Val(txt1) + Val(txt2)), 2)
So it will be rounded and only show the number and 2 decimal places.
-
Nov 20th, 2000, 04:53 PM
#7
Junior Member
Why wouldn't you just declare the variable that the txtbox is outputting as a Double?
-
Nov 20th, 2000, 05:24 PM
#8
Fanatic Member
You may could use this if you don't need it rounded
txtAve = Format(txtAve, "Fixed")
This would give you two decimal places.
JO
[Edited by joltremari on 11-20-2000 at 05:28 PM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|