Results 1 to 6 of 6

Thread: List box formating

  1. #1

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

    List box formating

    Hi everybody. I am having problems with this code. It is truncating what ever is intered into this list box and cutting off all the 0's. Any ideas on how to fix this?

    '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

    Thanks a bunch.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Widen the list box.

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2001
    Location
    Phoenix, AZ
    Posts
    44
    The width of the list box doesn't seem to matter. It still truncates the number and cuts off the rest of the 0's. Any other ideas?

  4. #4

    Thread Starter
    Member
    Join Date
    Jul 2001
    Location
    Phoenix, AZ
    Posts
    44
    Any new ideas?

  5. #5
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    just a wild guess...


    While Not m_oRecord.EOF
    cbStartRate.AddItem m_oRecord.Fields(0).Value
    cbStartRate.Text = Format(cbStartRate.Text, "0.000")
    m_oRecord.MoveNext
    Wend

    Not sure of this one but give it a try...

  6. #6
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    Hi
    1) You are formatting the value and then adding the unformatted value to your listbox or combobox
    2) You dont need to set the text property while looping
    3) Use Format$ instead of Format - quicker
    4) While.. Wend is not used nowadays but that wont cos a prob
    Regards
    Stuart
    VB Code:
    1. 'Your code....
    2. 'As long as we have something...
    3. cbStartRate.Text = Format(cbStartRate.Text, "0.000")
    4. While Not m_oRecord.EOF
    5. cbStartRate.AddItem [b]Format$([/b]m_oRecord.Fields(0).Value[b], "0.000")[/b]
    6. m_oRecord.MoveNext
    7. Wend
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

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