|
-
Sep 10th, 2001, 01:04 PM
#1
Thread Starter
Member
Text box formating
I want my text box to default all numbers that are typed into it to 3 decimal places.
ex:
you type 1, hit enter
and
it shows 1.000
The formatting that I have found truncates all the 0's and cuts them off leaving only the 1 instead of 1.000. Is there any way of setting the format to look this way without writing code? If not, does anyone have any ideas or code examples to set up the text boxes this way?
Thanks
-
Sep 10th, 2001, 01:06 PM
#2
Hyperactive Member
didn't test it, but can you try this?
text1.txt = 1
varia =
formvaria = Format(text1.text, "0.000")
-
Sep 10th, 2001, 01:08 PM
#3
Thread Starter
Member
didn't work. I am not sure what vari = means though.
-
Sep 10th, 2001, 01:12 PM
#4
Hyperactive Member
sorry,
leave it out
it must be:
text1.txt = "1"
formvaria = Format(text1.text, "0.000")
-
Sep 10th, 2001, 01:21 PM
#5
Use the Masked Edit Textbox. It makes it alot easier.
-
Sep 10th, 2001, 01:27 PM
#6
Thread Starter
Member
Cool! That worked great. Do you know how to do it for a list box too. Here is what I have, but it didn't work.
'Loading rates
Set m_oRecord = m_oConnect.GetRate
'As long as we have something...
cbStartRate.Text = Format(cbStartRate.Text, "0.000")
While Not m_oRecord.EOF
cbStartRate.AddItem m_oRecord.Fields(0).Value
m_oRecord.MoveNext
Wend
-
Sep 10th, 2001, 03:45 PM
#7
VB Code:
Private Sub Text1_Change()
Text1.Text = Format(Text1.Text, "0.000")
End Sub
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
|