How to update CListBox

This is a discussion on How to update CListBox within the Windows Programming forums, part of the Platform Specific Boards category; Hi all... I'm new to mfc programming, and have a question... hope you can help me I have a program ...

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    10

    How to update CListBox

    Hi all...

    I'm new to mfc programming, and have a question... hope you can help me

    I have a program that make some calculation, the user input some numbers and press a button to start.
    When he press the button, the program start the calculations, and shows the results in a Clistbox as it arrives.
    The problem is that when I use clistbox.addstring, the results are not automatically show in the clistbox, instead the user have to wait for all calculations to finish to see the results.
    What can I do to show the results as soon as it arrives in the clistbox, and continues to do the calculations in the background??

    Thx...

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Moved to Windows forum.

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    49
    Call a function to do the adding of the result to the listbox or have it do the the calculations in a function and return it for adding to the listbox. Either way, the result must be calculated and added to the list box before going on to the next item.

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    214
    If you want it to show after every addition you need to have the CListBox paint itself. Invalidate it and send WM_PAINT.

    Realize that this might slow your program down some.
    Last edited by DaveH; 05-18-2009 at 09:01 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Polymorphism; Update functions and accessibility
    By CaptainMaxxPow in forum C# Programming
    Replies: 2
    Last Post: 04-23-2009, 09:48 AM
  2. SQLite not performing update
    By OnionKnight in forum C Programming
    Replies: 0
    Last Post: 01-21-2009, 04:21 PM
  3. July 9 2008 MS XP Update
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 07-18-2008, 06:14 AM
  4. CListBox with Font and Color can be moved(MoveWindow) as you will.
    By 梦雨林 in forum Windows Programming
    Replies: 1
    Last Post: 06-07-2007, 03:07 PM
  5. CProgramming.com should update their tutorials.
    By PorkyChop in forum C++ Programming
    Replies: 17
    Last Post: 09-19-2004, 11:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21