Results 1 to 7 of 7

Thread: Text box formating

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2001
    Location
    Phoenix, AZ
    Posts
    44

    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

  2. #2
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    didn't test it, but can you try this?

    text1.txt = 1
    varia =
    formvaria = Format(text1.text, "0.000")

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2001
    Location
    Phoenix, AZ
    Posts
    44
    didn't work. I am not sure what vari = means though.

  4. #4
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    sorry,
    leave it out

    it must be:

    text1.txt = "1"
    formvaria = Format(text1.text, "0.000")

  5. #5
    spetnik
    Guest
    Use the Masked Edit Textbox. It makes it alot easier.

  6. #6

    Thread Starter
    Member
    Join Date
    Jul 2001
    Location
    Phoenix, AZ
    Posts
    44
    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

  7. #7
    DaoK
    Guest
    VB Code:
    1. Private Sub Text1_Change()
    2. Text1.Text = Format(Text1.Text, "0.000")
    3. 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
  •  



Click Here to Expand Forum to Full Width