A listbox control is drawing itself before it's been populated?

Posted on 2004-11-30
Last Modified: 2010-04-15
This list belongs to a group which is too high in the tab order, I think.  It's trying to draw itself when it hasn't yet been filled.

Any ideas about how to delay the drawing of the listbox or how to change the order of the group so this doesn't happen?

Question by:ba272
    LVL 6

    Expert Comment

    Whenever it adds an item to the listbox, it will get drawn. Can you post the code?
    LVL 20

    Accepted Solution

    The methods you need are BeginUpdate() and EndUpdate(). You should call BeginUpdate before you start adding elements to the list box and call EndUpdate after you are finished. Here is what MSDN says about BeginUpdate:

    Maintains performance while items are added to the ListBox one at a time by preventing the control from drawing until the EndUpdate method is called.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    In one of my recent projects, I was working with IP cameras, I need to take some pictures from the camera and do some processing on it. The first step, was to retrieve the image from camera into Image object. So that it can be displayed or …
    This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now