Microsoft KB Archive/175547

From BetaArchive Wiki
Knowledge Base

Article ID: 175547

Article Last Modified on 12/10/2003


  • Microsoft Visual Basic 4.0 Professional Edition
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 4.0 Enterprise Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition

This article was previously published under Q175547


Continually changing the Image properties of buttons on a Toolbar control results in an increased refreshed rate.


Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in Visual Studio 97 Service Pack 2.


Steps to Reproduce Issue

  1. Start a new Standard EXE project in Visual Basic. Form1 is created by default.
  2. Set a Reference to the "Microsoft Windows Common Controls" component.
  3. Add one CommandButton, one Toolbar, and one ImageList to Form1.
  4. Add two images to the ImageList control by completing the following steps:

    1. Click the Custom property of the ImageList control. The Property Pages dialog box appears.
    2. Click the Images tab.
    3. Click the Insert Picture button. The Select picture dialog box appears.
    4. Select two bitmap or icon files and click Open.
    5. Click OK to close the dialog box.
  5. Complete the following steps for the toolbar control:

    1. Click Custom property. The Property Pages dialog box appears.
    2. From the General Tab, set the ImageList property to ImageList1.
    3. From the Buttons Tab, click Insert Button to insert a button in the toolbar. Set the Image property to 1.
    4. Click OK to close the Property Pages dialog box.
  6. Copy the following code to the Code window of the Form1 form.

          Option Explicit
          Private Sub Command1_Click()
             Dim z As Integer, y As Integer
             For z = 1 To 100
                y = y + 1
                Toolbar1.Buttons(1).Image = y Mod 2 + 1
             Next z
          End Sub
  7. Press the F5 key to run the program. Note that the amount of time required to refresh the toolbar control increases with each iteration.

(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Arsenio Locsin, Microsoft Corporation

Additional query words: kbDSupport

Keywords: kbbug kbfix KB175547